Refactored code with NSFetchedResultsControllerDelegate protocol.