title: How to merge two lists of objects based on properties and merge duplicates into new object
body: <p>I'm struggling to find a simple solution to my problem:
  I have two lists of objects and want to compare them based on one property (Serial) and create a new list that contains objects from both lists. If the object is only in list one i want to mark it as deleted (Status), if its only in list two it should be marked as new (Status). if its in both i want to mark it as changed (Status) and store the old and new value (Amount/ NewAmount). </p>
  
  <p>So it looks something like this:</p>
  
  <p>List One:</p>
  
  <pre><code>[
      { 
          serial: 63245-8,
          amount:  10
      },
      { 
          serial: 08657-5,
          amount:  100
      }
      ,
      { 
          serial: 29995-0,
          amount:  500
      }
  ]
  </code></pre>
  
  <p>List Two:</p>
  
  <pre><code>[
      { 
          serial: 63245-8,
          amount:  100
      },
      { 
          serial: 67455-1,
          amount:  100
      }
      ,
      { 
          serial: 44187-10,
          amount:  50
      }
  ]
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[
      { 
          serial: 63245-8,
          amount:  10,
          newAmount:  100
          status: "changed"
      },
      { 
          serial: 08657-5,
          amount:  100
          status: "deleted"
      },
      { 
          serial: 29995-0,
          amount:  500,
          status: "deleted"
      }
      { 
          serial: 67455-1,
          amount:  100
          status: "new"
      }
      ,
      { 
          serial: 44187-10,
          amount:  50
          status: "new"
      }
  ]
  </code></pre>
  
  
  
  <p>I can't think of any good solution other than iterating over both lists and comparing with the other, building three different lists and merging them int the end and eventually even sorting them.
  I'm pretty sure there is a better solution to this, maybe even with AutoMapper ?
  Can anyone help me ?</p>
  
  <p>Thanks!</p>
  
  <p>Edit: Because the Question came up in the Comments.
  If Items are in both lists the Status can either be "changed" or "unchanged". It doesn't really matter for the implementation since i display the objects with their old and new amount and only want specially mark deleted and new objects. the Status "unchanged" would be a nice to have for future reference though.</p>