Utility extension function to synchronise elements of the MutableList.
fun <T> MutableList<T>.syncWithList(list: List<T>): Unit