         // Workaround for "Migration failed after first pass" error
         if (automigrating && 0 == self.persistentStores.count)
         {
+            println("[CoreDataKit] Applying workaround for 'Migration failed after first pass' bug, retrying...")
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(NSEC_PER_SEC) / 2), dispatch_get_main_queue(), addStore)
         }
     }

    {
        var coordinator: NSPersistentStoreCoordinator?

        if let managedObjectModel = optionalManagedObjectModel ?? NSManagedObjectModel(byMergingModels: nil)
        {
            coordinator = NSPersistentStoreCoordinator(managedObjectModel: managedObjectModel)
            coordinator?.addPersistentStoreWithType(NSInMemoryStoreType, configuration: nil, URL: nil, options: nil, error: error)


extension NSPersistentStoreCoordinator
{
    public class func coordinatorWithPersistentStore(URL optionalURL: NSURL?, automigrating: Bool, managedObjectModel optionalManagedObjectModel: NSManagedObjectModel?) -> NSPersistentStoreCoordinator?
    {
        var coordinator: NSPersistentStoreCoordinator?

        // Fallback on the defaults
        let _managedObjectModel = optionalManagedObjectModel ?? NSManagedObjectModel.mergedModelFromBundles(nil)
        let _URL = optionalURL ?? NSPersistentStore.URLForStoreName("CoreDataKit")

        // Initialize coordinator if we have all data
        switch ((_managedObjectModel, _URL)) {
            case let (.Some(managedObjectModel), .Some(URL)):
                coordinator = NSPersistentStoreCoordinator(managedObjectModel: managedObjectModel)
                coordinator?.addSQLitePersistentStoreWithURL(URL, automigrating: automigrating)

            default:
                break
