         fetchedController!.delegate = self
         
         collectionView.reloadData()
+    }
+    
+    public func numberOfSections(in collectionView: UICollectionView) -> Int {
+        return fetchedController?.sections?.count ?? 0
     }
     
     public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

        let visible = collectionView.indexPathsForVisibleItems
        
        let updateClosure = {
            for action in self.changeActions {
                let type = action.changeType
                switch(type) {
                case NSFetchedResultsChangeType.update:
                    if (self.ignoreOffScreenUpdates && !visible.contains(action.indexPath!)) {
                        continue
                    }
                    self.collectionView.reloadItems(at: [action.indexPath!])
                case NSFetchedResultsChangeType.insert:
                    self.collectionView.insertItems(at: [action.newIndexPath!])
                case NSFetchedResultsChangeType.delete:
                    self.collectionView.deleteItems(at: [action.indexPath!])
                case NSFetchedResultsChangeType.move:
                    self.collectionView.moveItem(at: action.indexPath!, to: action.newIndexPath!)
                }
            }
        }
        

    
    public func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
        Logging.log("controllerWillChangeContent")
        changeActions.removeAll()
    }
    
    public func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange sectionInfo: NSFetchedResultsSectionInfo, atSectionIndex sectionIndex: Int, for type: NSFetchedResultsChangeType) {
        changeActions.append(ChangeAction(sectionIndex: sectionIndex, indexPath: nil, newIndexPath: nil, changeType: type))
    }
    
    public func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
        changeActions.append(ChangeAction(sectionIndex: nil, indexPath: indexPath, newIndexPath: newIndexPath, changeType: type))
    }
    
    public func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
