 }
 
 extension DatabaseService {
-    func modelUrl() -> URL? {
-        guard let bundle = Bundle(identifier: "com.opensource.Database") else {
-            return nil
-        }
-        
-        guard let modelUrl = bundle.url(forResource: "Database", withExtension: "momd") else {
-            return nil
-        }
-        return modelUrl
-    }
-    func model() -> NSManagedObjectModel? {
-        return NSManagedObjectModel(at: modelUrl())
-    }
     func mr_setup() {
         // fucking magical record
         

        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)
            }
        })

    }
}


        }
    }
//    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()
