title: NSUndoManager, Core Data and selective undo/redo
body: <p>I'm working on a core data application that has a rather large hierarchy of managed objects similar to a tree.</p>
  
  <p>When a base object is created, it creates a few child objects which in turn create their own child objects and so on. Each of these child objects may gather information using NSURLConnections.</p>
  
  <p>Now, I'd like to support undo/redo with the undoManager in the managedObjectContext. The problem is, if a user creates a base object, then tries to undo that action, the base object is not removed. Instead, one or more of the child objects may be removed. Obviously this type of action is unpredictable and unwanted.</p>
  
  <p>So I tried disabling undo registration by default. I did this by calling <code>disableUndoRegistration:</code> before anything is modified in the managedObjectContext. Then, enabling undo registration before base operations such as creating a base object the again re-disabling registrations afterwords.</p>
  
  <p>Now when i try to undo, I get this error: </p>
  
  <blockquote>
    <p>undo: NSUndoManager 0x1026428b0 is in
    invalid state, undo was called with
    too many nested undo groups</p>
  </blockquote>
  
  <p>Thoughts?</p>