         let insertedObjects = context.insertedObjects as NSSet
         
         if insertedObjects.count > 0 {
-            var error: NSError?
-            let success: Bool
             do {
                 try context.obtainPermanentIDsForObjects(insertedObjects.map(){($0 as! NSManagedObject)})
-                success = true
-            } catch let error1 as NSError {
-                error = error1
-                success = false
-            }
-            
-            if success == false {
-                assert(true, "contextWillSave error : " + error!.localizedDescription)
+            } catch let error as NSError {
+                assert(true, "contextWillSave error : " + error.localizedDescription)
             }
         }
     }

        if NSFileManager.defaultManager().fileExistsAtPath(path) == false {
            do {
                try NSFileManager.defaultManager().createDirectoryAtPath(path,
                                withIntermediateDirectories: true,
                                attributes: nil)
                return true
            } catch _ {
                return false

        context.obtainPermanentIDsBeforeSaving()
        context.registerContextDidSaveNotification()
        return context
        }()
    
    private lazy var rootSaveingContext : NSManagedObjectContext = {
        var context = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
        context.performBlockAndWait({
            context.persistentStoreCoordinator = self.defaultCoordinator
        })
        context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
        return context
        }()
    
    private lazy var defaultCoordinator : NSPersistentStoreCoordinator = {
        var coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.defaultManagedObjectModel)
        
        do {
            try coordinator.addPersistentStoreWithType(
                NSSQLiteStoreType,
                configuration: nil,
                URL: self.storeURL(),
                options: nil)
        } catch let error as NSError {
            // re create
            let isMigrationError = (error.code == NSPersistentStoreIncompatibleVersionHashError) || (error.code == NSMigrationMissingSourceModelError)
            
            if error.domain == NSCocoaErrorDomain && isMigrationError {
                do {
                    try NSFileManager.defaultManager().removeItemAtURL(self.storeURL())
                } catch let error as NSError {
                    print("NSFileManager removeItemAtURL error : " + error.localizedDescription)
                    abort()
                }
                
                do {
                    try coordinator.addPersistentStoreWithType(
                        NSSQLiteStoreType,
                        configuration: nil,
                        URL: self.storeURL(),
                        options: nil)
                } catch let error as NSError {
                    print("create persistentStores error : " + error.localizedDescription)
                    abort()
                }
            }
