title: Assertion failure in -[UICollectionView _endItemAnimations] crash
body: <p>I am using core data in my application which will store the downloaded data. When app downloads the data i will save those in privateQueueContext (NSPrivateQueueConcurrencyType) </p>
  
  <p>As soon as core data save completes i should update the UI. To accomplish this i have defined NSFetchedResultsController delegate methods. As i expected those delegate methods are called when change occurs in core data. </p>
  
  <p>In <code>didChangeObject</code> method i am inserting new cell but it leads to crash when there was many objects inserted in core data and gives following error message </p>
  
  <blockquote>
    <p>*** Assertion failure in -[UICollectionView _endItemAnimations]
    CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (379) must be equal to the number of items contained in that section before the update (325), plus or minus the number of items inserted or deleted from that section (52 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out). with userInfo (null) </p>
  </blockquote>
  
  <p>I am assuming datasource changes before completing new cell insert animation. </p>
  
  <p>I hope many people would have faced same issue and there are so many similar questions in stack overflow but none of the answer is working properly for me. Can you someone please help me out on this?</p>
  
  <p><strong>Inserting new object in Core data</strong></p>
  
  <pre><code>for (NSDictionary *obj in books){
      Book *book = [Book insertInManagedObjectContext:context];
      book.udid = [obj objectForKey:@“id”]  
  }
  
  [context performBlock:^{
     NSError *error = nil;
     if ([context save:&amp;error]) {
          NSLog(@“success”);
     }                
  }];
  </code></pre>
  
  <p><strong>Fetch results controller delegate</strong></p>
  
  <pre><code>- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
     self.blockOperation = [NSBlockOperation new];
    }
  
  - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath {
     __weak UICollectionView *collectionView = self.collectionView;
     switch(type) {
        case NSFetchedResultsChangeInsert:{
             [self.blockOperation addExecutionBlock:^{
              [collectionView insertItemsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForItem:newIndexPath.item + 1 inSection:newIndexPath.section]]];
             }];
             break;
        }
        default:
          break;
     }
  }
  
  - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
      [self.collectionView performBatchUpdates:^{
      [self.blockOperation start];
      } completion:nil];
    }
  </code></pre>