     }
     
     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
+        container = DatabaseContainer.container()
+        container?.setup()
     }
     
     override func tearDown() {
         do {
-            try persistentContainer?.viewContext.save()
+            try container?.viewContext()?.save()
         }
         catch let error {
             LoggingService.logError("\(self) \(#function) error: \(error)")

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

    }
}


}

extension DatabaseService {
    func mr_setup() {
        // fucking magical record
        
