title: How do I use Magical Record to create & update objects and save them without using contextForCurrentThread
body: <p>I just read the author of MagicalRecord's blog post on <a href="http://saulmora.com/2013/09/15/why-contextforcurrentthread-doesn-t-work-in-magicalrecord/">Why contextForCurrentThread Doesn't work in MagicalRecord</a>.</p>
  
  <p><code>contextForCurrentThread</code> is deprecated and <code>saveWithBlock</code> should be used instead because it creates a safe new <code>NSManagedObjectContext</code> for the relevant thread.</p>
  
  <p>I've been using <code>contextForCurrentThread</code> extensively in my app so far. However, I'm having trouble figuring out how to use <code>saveWithBlock</code> instead as my fetching and saving are not necessarily happening sequentially.</p>
  
  <p>Currently I'm doing things like:</p>
  
  <p><pre><code>localContext = NSManagedObjectContext.MR_contextForCurrentThread
  person = Person.MR_createInContext(localContext)
  person.name = "John Smith"</pre></code></p>
  
  <p>The user may then browse around the app, different controllers, views etc. are displayed. Other objects may be created using a similar method to the code above.</p>
  
  <p>Then at some arbitrary point in the future, when the user decides to save, I run this method:</p>
  
  <pre><code>localContext = NSManagedObjectContext.MR_contextForCurrentThread
  localContext.MR_saveToPersistentStoreWithCompletion(
    lambda { |success, error|
      # ...
    }
  )</code></pre>
  
  <p>What is the recommended way to create &amp; update objects and then save them without using <code>contextForCurrentThread</code>?</p>