 
         // Optionally refresh this worker moc whenever the main MOC saves.
         if shouldReceiveUpdates {
-            backgroundContextsNeedingRefresh.append(context)
+            backgroundContextsNeedingRefresh.addObject(context)
         }
 
         return context

*/

public class ThreadConfinementStack: CoreDataStack {
    private var backgroundContextsNeedingRefresh = [NSManagedObjectContext]()

    /**
    Primary managed object context for main queue work.

    }

    @objc private func mergeChangedFromMainQueueContextSaveNotification(notification: NSNotification) {
        dispatch_sync(dispatch_queue_create("com.bignerdranch.coredatastack.locking.queue", nil)) { [unowned self] in
            if let contexts = self.backgroundContextsNeedingRefresh.allObjects as? [NSManagedObjectContext] {
                for context in contexts {
                    context.performBlockAndWait() {
                        context.mergeChangesFromContextDidSaveNotification(notification)
                    }
                }
            }
        }
    }
