title: iOS CoreData+MoGenerator: How do I initialize a Managed Object once only when I am using nested contexts?
body: <p>I am using mogenerator to generate code from a model with a TestPerson managed object. TestPerson inherits from the abstract object TLSyncParent. In TLSyncParent I have the code:</p>
  
  <pre><code>- (void) awakeFromInsert
  {
      [super awakeFromInsert];
      QNSLOG(@"%@\n%@", self.managedObjectContext, self.description);
      if (self.syncStatus == nil) {
          self.syncStatusValue = SYNCSTATUS_NEW;
          self.tempObjectPID = [self generateUUID];
          QNSLOG(@"After init values\n%@", self.description);
      }
  }
  </code></pre>
  
  <p>I create the TestPerson object in childMOC whose parent is mainMOC, whose parent is rootMOC. awakeFromInsert runs as expected and makes the init changes. When I save childMOC to mainMOC, awakeFromInsert is run again. From the docs I would not expect that, but there is some ambiguity. From the Docs, "You typically use this method to initialize special default property values. This method is invoked only once in the object's lifetime." The real problem is that when awakeFromInsert runs in mainMOC, the init changes made in childMOC are NOT there. awakeFromInsert is apparently run before the save actually takes place.</p>
  
  <pre><code>2013-10-02 11:22:45.510_xctest[21631:303] TestPerson -awakeFromInsert &lt;NSManagedObjectContext: 0xd684780&gt;
  &lt;TestPerson: 0xd6863b0&gt; (entity: TestPerson; id: 0xd684ed0 &lt;x-coredata:///TestPerson/t02B71E0D-AE3F-4605-8AC7-638AE072F2302&gt; ; data: {
      dept = nil;
      job = nil;
      objectPID = nil;
      personName = nil;
      syncStatus = 0;
      tempObjectPID = nil;
      updatedAt = nil;
  })
  2013-10-02 11:22:45.511_xctest[21631:303] TestPerson -awakeFromInsert After init values
  &lt;TestPerson: 0xd6863b0&gt; (entity: TestPerson; id: 0xd684ed0 &lt;x-coredata:///TestPerson/t02B71E0D-AE3F-4605-8AC7-638AE072F2302&gt; ; data: {
      dept = nil;
      job = nil;
      objectPID = nil;
      personName = nil;
      syncStatus = 4;
      tempObjectPID = "7AB46623-C597-4167-B189-E3AAD24954DE";
      updatedAt = nil;
  })
  2013-10-02 11:22:45.511_xctest[21631:303] CoreDataController -saveChildContext: Saving Child MOC
  2013-10-02 11:22:45.511_xctest[21631:303] TestPerson -awakeFromInsert &lt;NSManagedObjectContext: 0xd682180&gt;
  &lt;TestPerson: 0xd68fce0&gt; (entity: TestPerson; id: 0xd684ed0 &lt;x-coredata:///TestPerson/t02B71E0D-AE3F-4605-8AC7-638AE072F2302&gt; ; data: {
      dept = nil;
      job = nil;
      objectPID = nil;
      personName = nil;
      syncStatus = 0;
      tempObjectPID = nil;
      updatedAt = nil;
  })
  2013-10-02 11:22:45.511_xctest[21631:303] TestPerson -awakeFromInsert After init values
  &lt;TestPerson: 0xd68fce0&gt; (entity: TestPerson; id: 0xd684ed0 &lt;x-coredata:///TestPerson/t02B71E0D-AE3F-4605-8AC7-638AE072F2302&gt; ; data: {
      dept = nil;
      job = nil;
      objectPID = nil;
      personName = nil;
      syncStatus = 4;
      tempObjectPID = "B799AFDA-3514-445F-BB6F-E4FE836C4F9D";
      updatedAt = nil;
  })
  </code></pre>
  
  <p>What is the proper place to initialize a managed object when using the MoGenerator structure?</p>