title: Save model state between viewControllers with Realm - it breaks relation
body: <p>I use Realm in my swift project.</p>
  
  <p>Here are my objects, Meal and Reaction - with a mapping of one to many: </p>
  
  <pre><code>enum DishType: String{
    case Breakfast
    case Second_breakfast
    case Brunch
    case Elevenses
    case Lunch
    case Tea
    case Dinner
    case Supper
    case Snack
  }
  
  class Meal : Object{
    dynamic var date: NSDate = NSDate()
    dynamic var dishType = DishType.Breakfast.rawValue
  
    var dishTypeEnum: DishType{
      get{
        return DishType(rawValue: dishType)!
      }
      set{
        dishType = newValue.rawValue
      }
    }
  
    dynamic var foodItems: String = ""
    var reactions = List&lt;Reaction&gt;()
  }
  
  
  enum Category: String{
    case Apetit
    case Energy
    case Emotion
  }
  
  enum Type: String{
    case Positive
    case Negative
  }
  
  class Reaction: Object{
  
    dynamic var category = Category.Apetit.rawValue
    dynamic var text: String?
    dynamic var selected: Bool = false
    dynamic var type = Type.Positive.rawValue
    .....
  }
  </code></pre>
  
  <p>I need to save state from one viewController to the other. 
  I select some reactions, which I have to see selected when returning to the reactions screen. </p>
  
  <p><a href="https://i.stack.imgur.com/V559m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V559m.png" alt="saving Reaction state"></a></p>
  
  <p>I was thinking saving into Realm, but I also have to clear all reactions state when entering a new set of data. 
  When deleting from Reaction, it seems that it also breaks the relation. I have Meal objects saved (which also have a relation with Reaction). </p>
  
  <p>I do not know how to distinguish between Reactions that indicate state and the ones that are in relation, from a saved Meal.</p>
  
  <p>I was thinking saving Reactions for state, just in NSUserDefaults. But like this I will combine both frameworks. </p>
  
  <p>What to you think? How do you save state?</p>