         guard checkStack() else {
             return
         }
-        
-        
-        self.persistentContainer?.performBackgroundTask({ (backgroundContext) in
-            do {
-                try autoreleasepool {
-                    block(backgroundContext)
-                    //        DatabaseSupplement.save(block: block, context: theContext, completion: completion)
-                    try backgroundContext.save()
-                    completion?(true, nil)
-                }
-            }
-            catch let error {
-                completion?(false, error)
-            }
-        })
-
+        container?.save(block: block, completion: completion)
     }
 }
 

    }
    
    override func setup() {
        guard let model = model() else {
            return
        }
        persistentContainer = NSPersistentContainer(name: "Database", managedObjectModel: model)
        persistentContainer?.loadPersistentStores(completionHandler: {
            [unowned self]
            (description, error) in
            self.accidentError = error
        })
        persistentContainer?.viewContext.automaticallyMergesChangesFromParent = true
    }
    
    override func tearDown() {
        do {
            try persistentContainer?.viewContext.save()
        }
        catch let error {
            LoggingService.logError("\(self) \(#function) error: \(error)")

        }
    }
//    var stack: MagicalRecordStack?
    var container: DatabaseContainerProtocol?
    var accidentError: Error?
    func checkStack() -> Bool {
        return container != nil && accidentError == nil && context != nil
    }
    func viewContext() -> NSManagedObjectContext? {
        return container?.viewContext()
    }
    lazy var context: NSManagedObjectContext? = {
        return self.viewContext()
