         var currentContext: NSManagedObjectContext? = self.mainManagedObjectContext
         
         while let c = currentContext {
-            c.performBlock {
+            c.performBlockAndWait {
                 var error: NSError? = nil
                 c.save(&error)
                 c.reset()

        var currentContext: NSManagedObjectContext? = self.mainManagedObjectContext
        
        while let c = currentContext {
            c.performBlock {
                c.mergeChangesFromContextDidSaveNotification(notification)
            }
            

    }
    
    @objc private func persistentStoreCoordinatorStoresDidChange(notification: NSNotification) {
        self.performBlockAndWait {
            self.reset()
        }
    }
    
    @objc private func persistentStoreDidImportUbiquitousContentChanges(notification: NSNotification) {
        self.performBlockAndWait {
            self.mergeChangesFromContextDidSaveNotification(notification)
        }
    }
