title: Adding to Managed Object Ordered Set
body: <p>I have a test app with two entities, folder with a relationship of <strong>To Many</strong> with another object called List. </p>
  
  <p>In my storyboard I have a tableview controller with the list of created folders. When tapping on a folder I segue to another TableView passing on the <code>selectedFolder</code> which should display the List ordered set saved to the selectedFolder. I have a modal that appears to add a item to the List. </p>
  
  <p>Unfortunately I have not been able to save a List to the selectedFolder ordered set. I receive an error when executing the save function <code>unrecognized selector sent to instance</code> this error is because of the following line: </p>
  
  <pre><code>selectedFolder.list = list.copy() as! NSOrderedSet
  </code></pre>
  
  <p>I am not sure what I am doing wrong with the save function and was wondering if anyone could help, it would be much appreciated. </p>
  
  <p><strong>Folder Subclass:</strong></p>
  
  <pre><code>class Folder: NSManagedObject {
  
  @NSManaged var title: String
  @NSManaged var details: String
  @NSManaged var date: NSDate
  @NSManaged var list: NSOrderedSet
  
  }
  </code></pre>
  
  <p><strong>List Subclass</strong> </p>
  
  <pre><code>class List: NSManagedObject {
  
  @NSManaged var item: String
  @NSManaged var folder: Event
  
  }
  </code></pre>
  
  <p><strong>Modal View to add List to selected Folder ordered set.</strong> </p>
  
  <pre><code>class PopoverViewController: UIViewController {
  
  //selectedFolder passed from segue. Works fine displays title of folder
  var selectedFolder: Folder!
  
  @IBOutlet weak var popoverTextField: UITextView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      self.popoverTextField.becomeFirstResponder()
      // Do any additional setup after loading the view.
  }
  
  
  @IBAction func addListItem(sender: AnyObject) {
  
      //Get the context
      let moc = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext
  
      //get entity details
      let entity = NSEntityDescription.entityForName("List", inManagedObjectContext: moc!)
  
      //Create the managed object to be inserted
      let list = List(entity: entity!, insertIntoManagedObjectContext: moc!)
  
      // Add Text 
  
      list.item = popoverTextField.text
  
      //Insert the new checklist into the folder set
  
      var folder = selectedFolder.list.mutableCopy() as! NSMutableOrderedSet
      folder.addObject(list)
  
      selectedFolder.list = list.copy() as! NSOrderedSet
  
      //Error check &amp; Save
  
      var error: NSError?
      if moc!.save(&amp;error){
        println("Could not save: \(error)")
      }
  }
  </code></pre>