     }
     
     @objc func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
-        self.updateSectionCounts()
+        previousSectionCounts = fetchSectionCounts()
         sectionChanges = []
         objectChanges = []
     }

        }
        
        guard isSlidingNewContentInFromTheTopEnabled else {
            performBatchUpdates(sectionCounts: sectionCounts, previousSectionCounts: previousSectionCounts)
            return
        }

        guard let columnarLayout = collectionView.collectionViewLayout as? ColumnarCollectionViewLayout else {
            performBatchUpdates(sectionCounts: sectionCounts, previousSectionCounts: previousSectionCounts)
            return
        }
        

        sectionChanges.append(sectionChange)
    }
    
    private var previousSectionCounts: [Int] = []
    private var sectionCounts: [Int] = []
    private func fetchSectionCounts() -> [Int] {
        let sections = fetchedResultsController.sections ?? []
        return sections.map { $0.numberOfObjects }
    }
    
    @objc func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
       sectionCounts = fetchSectionCounts()
        var didInsertFirstSection = false
        var didOnlyChangeItems = true
        var sectionDelta = 0
