         
         if !self.addPersistentStore(coordinator, config: config, abortOnFailure: !self.wipeDatabaseOnConflict) && self.wipeDatabaseOnConflict {
             Logging.log("Will delete DB")
-            try! NSFileManager.defaultManager().removeItemAtURL(url)
+            try! NSFileManager.defaultManager().removeItemAtURL(url!)
             self.addPersistentStore(coordinator, config: config, abortOnFailure: true)
         }
         

        self.init(modelName: modelName, storeType: NSSQLiteStoreType)
    }
    
    public init(modelName: String, storeType: String) {
        self.modelName = modelName
        self.storeType = storeType
    }
    
    public init(parentContext: NSManagedObjectContext) {

    }()

    
    lazy var workingFilesDirectory: NSURL = {
        let urls = NSFileManager.defaultManager().URLsForDirectory(self.inDirectory, inDomains: .UserDomainMask)
        let last = urls.last!
        let identifier = NSBundle.mainBundle().bundleIdentifier!
        let appFolder = last.URLByAppendingPathComponent(identifier)
        let dbFolder = appFolder.URLByAppendingPathComponent("DB")
        do {
            try NSFileManager.defaultManager().createDirectoryAtURL(dbFolder, withIntermediateDirectories: true, attributes: nil)
        } catch let error as NSError {
            print("Create db folder error \(error)")
        }
        return dbFolder
    }()
    
    lazy var managedObjectModel: NSManagedObjectModel = {
