public void handleCollectionChanges(IEnumerable <CollectionChange> changes)
        {
            lock (animationLock)
            {
                if (changes.Any(c => c.Type == CollectionChangeType.Reload))
                {
                    tableView.ReloadData();
                    return;
                }

                tableView.BeginUpdates();

                foreach (var change in changes)
                {
                    NSIndexPath       indexPath  = NSIndexPath.FromRowSection(change.Index.Row, change.Index.Section);
                    NSIndexPath[]     indexPaths = { indexPath };
                    NSMutableIndexSet indexSet   = (NSMutableIndexSet)NSIndexSet.FromIndex(change.Index.Section).MutableCopy();

                    switch (change.Type)
                    {
                    case CollectionChangeType.AddRow:
                        tableView.InsertRows(indexPaths, UITableViewRowAnimation.Automatic);
                        break;

                    case CollectionChangeType.RemoveRow:
                        tableView.DeleteRows(indexPaths, UITableViewRowAnimation.Automatic);
                        break;

                    case CollectionChangeType.UpdateRow:
                        tableView.ReloadRows(indexPaths, UITableViewRowAnimation.Automatic);
                        break;

                    case CollectionChangeType.MoveRow:
                        if (change.OldIndex.HasValue)
                        {
                            NSIndexPath oldIndexPath = NSIndexPath.FromRowSection(change.OldIndex.Value.Row, change.OldIndex.Value.Section);
                            tableView.MoveRow(oldIndexPath, indexPath);
                            dataSource.RefreshHeader(tableView, change.OldIndex.Value.Section);
                        }
                        break;

                    case CollectionChangeType.AddSection:
                        tableView.InsertSections(indexSet, UITableViewRowAnimation.Automatic);
                        break;

                    case CollectionChangeType.RemoveSection:
                        tableView.DeleteSections(indexSet, UITableViewRowAnimation.Automatic);
                        break;
                    }

                    dataSource.RefreshHeader(tableView, change.Index.Section);
                }

                tableView.EndUpdates();
            }
        }
        public void handleCollectionChanges(IReadOnlyCollection <ICollectionChange> changes)
        {
            lock (animationLock)
            {
                if (changes.Any(c => c is ReloadCollectionChange))
                {
                    tableView.ReloadData();
                    return;
                }

                tableView.BeginUpdates();

                foreach (var change in changes)
                {
                    var affectedSections = new List <int>();

                    switch (change)
                    {
                    case AddRowCollectionChange <TModel> addRow:
                        var addedToSection = add(addRow);
                        affectedSections.Add(addedToSection);
                        break;

                    case InsertSectionCollectionChange <TModel> insert:
                        insertSection(insert);
                        break;

                    case RemoveRowCollectionChange removeRow:
                        var removedFromSection = remove(removeRow);
                        affectedSections.Add(removedFromSection);
                        break;

                    case MoveRowWithinExistingSectionsCollectionChange <TModel> moveRow:
                        var oldAndNewSection = move(moveRow);
                        affectedSections.AddRange(oldAndNewSection);
                        break;

                    case MoveRowToNewSectionCollectionChange <TModel> moveRowToNewSection:
                        var oldSection = move(moveRowToNewSection);
                        affectedSections.Add(oldSection);
                        break;

                    case UpdateRowCollectionChange <TModel> updateRow:
                        var updatedInSection = update(updateRow);
                        affectedSections.Add(updatedInSection);
                        break;
                    }

                    dataSource.ChangeDisplayedCollection(change);

                    affectedSections
                    .Distinct()
                    .Where(index => index < dataSource.NumberOfSections(tableView))
                    .ForEach(index => dataSource.RefreshHeader(tableView, index));
                }

                tableView.EndUpdates();
            }
        }
        private void handleCollectionChange(ICollectionChange change)
        {
            lock (animationLock)
            {
                tableView.BeginUpdates();

                var sectionsNeedingHeaderRefresh = updateTable(change);
                dataSource.ChangeDisplayedCollection(change);

                tableView.EndUpdates();

                sectionsNeedingHeaderRefresh.ForEach(index =>
                                                     dataSource.RefreshHeader(tableView, index));
            }
        }