             }
             // Ignore inserts for collapsed sections
             self.itemUpdates.inserted = self.itemUpdates.inserted.filter {
-                return !self.collapsedSections.contains($0._section)
+                return !_collapsed.contains($0._section)
             }
             
             // Ignore inserts for collapsed sections

        let target = processSections()
        
        // If any of the sections are collapsed we may need to adjust some of the edits
        if !collapsedSections.isEmpty || defaultCollapse {
            var _collapsed = Set<Int>()
            for sec in target {
                if let s = sec?.source, self.collapsedSections.contains(s),

    }
    
    public func collapseSection(at sectionIndex: Int, animated: Bool) {
        guard !collapsedSections.contains(sectionIndex) else { return }
        let ips = (0..<self.numberOfItems(in: sectionIndex)).map { return IndexPath.for(item: $0, section: sectionIndex) }
        collapsedSections.insert(sectionIndex)
        self.collectionView.deleteItems(at: ips, animated: animated)
    }
    
    public func expandSection(at sectionIndex: Int, animated: Bool) {
        guard collapsedSections.remove(sectionIndex) != nil else { return }
        let ips = (0..<self.numberOfItems(in: sectionIndex)).map { return IndexPath.for(item: $0, section: sectionIndex) }
        self.collectionView.insertItems(at: ips, animated: animated)
    }
