title: Use MagicalRecord with another existing context in RestKit
body: <p>I want to keep using my current RestKit while use MagicRecord for rest of fetches and updates. I want Restkit's MOC send updates to MagicRecord's default context. If I understand right, this is what I am doing. Is this ok?</p>
  
  <pre><code>NSManagedObjectContext* context = [[RKObjectManager sharedManager].objectStore managedObjectContextForCurrentThread];
  [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:[XDBStore storeName]];
  [context setParentContext:[NSManagedObjectContext MR_defaultContext]];
  </code></pre>
  
  <p>Maybe another way to do it, but still not sure.</p>
  
  <pre><code>NSPersistentStoreCoordinator *coordinator = [[[RKObjectManager sharedManager] objectStore] persistentStoreCoordinator]; 
  [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 
  [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator];
  </code></pre>
  
  <p>Anyone had same issue before?</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I tried the @casademora's suggestion #1 to set default context, but got this error.</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can only use -performBlockAndWait: on an NSManagedObjectContext that was created with a queue.'
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>I found a hack. First, open up the setter for default context at magicalrecord. Next, change the concurrency type for RestKit store so its context can be used at magicalrecord.</p>
  
  <p><strong>NSManagedObjectContext+MagicalRecord.h</strong></p>
  
  <pre><code>+ (void) MR_setDefaultContext:(NSManagedObjectContext *)moc;
  + (void) MR_setRootSavingContext:(NSManagedObjectContext *)context;
  </code></pre>
  
  <p><strong>RKManagedObjectStore.m</strong></p>
  
  <pre><code>NSManagedObjectContext *managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
  </code></pre>
  
  <p><strong>Then setup MagicalRecord like this:</strong></p>
  
  <pre><code>NSManagedObjectContext* context = [[RKObjectManager sharedManager].objectStore managedObjectContextForCurrentThread];
  [NSManagedObjectContext MR_setRootSavingContext:context];
  
  NSManagedObjectContext *defaultContext = [NSManagedObjectContext MR_newMainQueueContext];
  [defaultContext setParentContext:context];
  [NSManagedObjectContext MR_setDefaultContext:defaultContext];
  </code></pre>