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

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

        }
        
        guard isSlidingNewContentInFromTheTopEnabled else {
            performBatchUpdates()
            return
        }

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