             NSThread.isMainThread(),
             "Attempted to add an observer of type \(typeName(observer)) outside the main thread."
         )
-        
         self.removeObserver(observer)
         
         self.registerChangeNotification(

    @warn_unused_result
    public func objectsInSection(section: Int) -> [T] {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        return (self.fetchedResultsController.sections?[section].objects as? [T]) ?? []
    }
    
    /**
     Returns all objects in the specified section, or `nil` if out of bounds.
     
     - parameter section: the section index. Using an index outside the valid range will return `nil`.
     - returns: all objects in the specified section
     */
    @warn_unused_result
    public func objectsInSection(safeSectionIndex section: Int) -> [T]? {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        return (self.fetchedResultsController.sections?[section].objects as? [T]) ?? []
    }
    
    /**
     Returns the number of sections
     
     - returns: the number of sections
     */
    @warn_unused_result
    public func numberOfSections() -> Int {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        return self.fetchedResultsController.sections?.count ?? 0
    }
    
    /**
     Returns the number of objects in all sections
     
     - returns: the number of objects in all sections
     */
    @warn_unused_result
    public func numberOfObjects() -> Int {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        return self.fetchedResultsController.fetchedObjects?.count ?? 0
    }
    
    /**
     Returns the number of objects in the specified section
     
     - parameter section: the section index. Using an index outside the valid range will throw an exception.
     - returns: the number of objects in the specified section
     */
    @warn_unused_result
    public func numberOfObjectsInSection(section: Int) -> Int {
        
        return self.sectionInfoAtIndex(section).numberOfObjects
    }
    
    /**
     Returns the number of objects in the specified section, or `nil` if out of bounds.
     
     - parameter section: the section index. Using an index outside the valid range will return `nil`.
     - returns: the number of objects in the specified section
     */
    @warn_unused_result
    public func numberOfObjectsInSection(safeSectionIndex section: Int) -> Int? {
        
        return self.sectionInfoAtIndex(safeSectionIndex: section)?.numberOfObjects
    }
    
    /**
     Returns the `NSFetchedResultsSectionInfo` for the specified section
     
     - parameter section: the section index. Using an index outside the valid range will throw an exception.
     - returns: the `NSFetchedResultsSectionInfo` for the specified section
     */
    @warn_unused_result
    public func sectionInfoAtIndex(section: Int) -> NSFetchedResultsSectionInfo {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        return self.fetchedResultsController.sections![section]
    }
    
    /**
     Returns the `NSFetchedResultsSectionInfo` for the specified section, or `nil` if out of bounds.
     
     - parameter section: the section index. Using an index outside the valid range will return `nil`.
     - returns: the `NSFetchedResultsSectionInfo` for the specified section, or `nil` if the section index is out of bounds.
     */
    @warn_unused_result
    public func sectionInfoAtIndex(safeSectionIndex section: Int) -> NSFetchedResultsSectionInfo? {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        guard let sections = self.fetchedResultsController.sections
            where section < sections.count else {
                
                return nil
        }
        
        return sections[section]
    }
    
    /**
     Returns the `NSFetchedResultsSectionInfo`s for all sections
     
     - returns: the `NSFetchedResultsSectionInfo`s for all sections
     */
    @warn_unused_result
    public func sections() -> [NSFetchedResultsSectionInfo] {
        
        CoreStore.assert(
            !self.isPendingRefetch || NSThread.isMainThread(),
            "Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
        )
        
        return self.fetchedResultsController.sections ?? []
    }
    

            NSThread.isMainThread(),
            "Attempted to add an observer of type \(typeName(observer)) outside the main thread."
        )
        self.removeObserver(observer)
        
        self.registerChangeNotification(
