title: Getting "An entity with the same identity already exists in this EntitySet" but the EntitySet is empty
body: <p>When I try to add a new item to my EntitySet, I'm getting this exception:</p>
  
  <blockquote>
    <p>An entity with the same identity
    already exists in this EntitySet</p>
  </blockquote>
  
  <p>However, when I inspect the EntitySet its count is 0.</p>
  
  <p>Any ideas why I would be getting this error when the set is empty? How could an entity already exist in the set if the set has no items in it?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've narrowed this down a bit more. This is only happening if I add the item to the set, remove it, then re-add it. Even tho the item isn't in the EntitySet any more it is still remembering it somehow. What do I need to do to make it forget?</p>
  
  <p><strong>UPDATE:</strong> Here are some code snippets for the classes and logic involved.</p>
  
  <p>Server Entities:</p>
  
  <pre><code>public class PhotoDto
  {
      [Key]
      [Editable(false)]
      public int Id { get; set; }
  
      /* clip */
  
      [Include]
      [Association("Photo_Destination", "Id", "PhotoId")]
      public EntitySet&lt;PhotoDestinationDto&gt; Destinations { get; set; }
  }
  
  public class PhotoDestinationDto : BaseDestionationDto
  {
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public int PhotoId { get; set; }
  
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public bool IsAnnotated { get; set; }
  
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public int DropZoneId { get; set; }
  }
  
  public class BaseDestinationDto
  {
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public Guid DatabaseUid { get; set; }
  
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public string Unit { get; set; }
  
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public string EqCircId { get; set; }
  
      [Key]
      [Editable(false, AllowInitialValue = true)]
      public string EqType { get; set; }
  }
  </code></pre>
  
  <p>Client side GetIdentity() for PhotoDestinationDto:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Computes a value from the key fields that uniquely identifies this entity instance.
  /// &lt;/summary&gt;
  /// &lt;returns&gt;An object instance that uniquely identifies this entity instance.&lt;/returns&gt;
  public override object GetIdentity()
  {
      if ((((this._eqCircId == null) 
                  || (this._eqType == null)) 
                  || (this._unit == null)))
      {
          return null;
      }
      return EntityKey.Create(this._dropZoneId, this._eqCircId, this._eqType, this._isAnnotated, this._photoId, this._unit, this._databaseUid);
  }
  </code></pre>
  
  <p>To remove photo destination client side:</p>
  
  <pre><code>PhotoDto photo = GetPhotoDto();
  PhotoDestinationDto destToRemove = photo.Destinations.First(x =&gt; x.DropZoneId == 1);
  photo.Destinations.Remove(destToRemove);
  </code></pre>
  
  <p>To add photo destination client side:</p>
  
  <pre><code>var dest = new PhotoDestinationDto
  {
      DropZoneId = zoneId,
      EqCircId = selectedEqCircId,
      EqType = selectedEqType,
      Unit = selectedUnit,
      PhotoId = id,
      DatabaseUid = selectedDatabaseId
  };
  
  p.Destinations.Add(dest); // this is where exception is thrown. p.Destinations.Count is 0 here.
  </code></pre>