 Calling save() on any NSMangedObjectContext belonging to the stack will automatically bubble the changes all the way to the NSPersistentStore
 */
 public final class CoreDataStack {
+    
     /**
     Primary persisting background managed object context. This is the top level context that possess an
     NSPersistentStoreCoordinator and saves changes to disk on a background queue.

    The main queue context for any work that will be performed on the main queue.
    Its parent context is the primary private queue context that persist the data to disk.
    Making a save() call on this context will automatically trigger a save on its parent via NSNotification.

    - returns: NSManagedObjectContext The main queue context.
    */
    public let mainQueueContext: NSManagedObjectContext = {
        var managedObjectContext: NSManagedObjectContext!

        case .SQLite(let storeURL):
            let coordinator = persistentStoreCoordinator
            let mom = managedObjectModel

            guard let store = coordinator.persistentStoreForURL(storeURL) else {
                let error = CoreDataStackError.StoreNotFoundAtURL(url: storeURL)
                resetCallback(.Failure(error))
                break
            }

            let backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)
            dispatch_async(backgroundQueue) {
                dispatch_group_notify(self.saveBubbleDispatchGroup, dispatch_get_main_queue()) {
                    do {
                        try coordinator.removePersistentStore(store)
                        try NSFileManager.defaultManager().removeItemAtURL(storeURL)

                        // Remove journal files if present
                        let _ = try? NSFileManager.defaultManager().removeItemAtURL(storeURL.URLByAppendingPathComponent("-shm"))
                        let _ = try? NSFileManager.defaultManager().removeItemAtURL(storeURL.URLByAppendingPathComponent("-wal"))

                        // Setup a new stack
                        NSPersistentStoreCoordinator.setupSQLiteBackedCoordinator(mom, storeFileURL: storeURL) { result in
                            switch result {
                            case .Success (let coordinator):
                                self.persistentStoreCoordinator = coordinator
                                resetCallback(.Success)
                            case .Failure (let error):
                                resetCallback(.Failure(error))
                            }
                        }
                    } catch let fileRemoveError {
                        resetCallback(.Failure(fileRemoveError))
                    }
                }
            }
        }
