title: Realm Swift How to update an List object
body: <p>I have a problem when I try to update a value on a List.
  This is my DB model:</p>
  
  <pre><code>class User: Object {
  
  @objc dynamic var id : Int = 0
  @objc dynamic var height : Int = 0
  @objc dynamic var age : Int = 0
  @objc dynamic var sex : String = ""
  @objc dynamic var physicalActivity : Double = 1.0
  @objc dynamic var goal : String = ""
  let weightProgress = List&lt;WeightProgress&gt;()
  let calories = List&lt;Calories&gt;()
  
  override static func primaryKey() -&gt; String? {
      return "id"
  
  }
  }
  
  
  class Calories : Object {
  
  @objc dynamic var date : String?
  @objc dynamic var eatenCalories : Int = 0
  
  }
  </code></pre>
  
  <p>The main feature is, User put how many calories he ate, and save it to DB. Date is generated by <code>Date()</code> and convert to <code>String</code>. If next value has the same <code>Date</code> I want to updated existing <code>eatenCalories</code> property, if <code>Date</code> is different I want to create another record to DB.</p>
  
  <p>Any ideas?</p>
  
  <p>Now after each value adding it create another record in DB.</p>
  
  <p>BR
  iMat</p>