title: An entity object cannot be referenced by multiple instances of IEntityChangeTracker. On multiple entries
body: <p>I have a work object:</p>
  
  <pre><code>public class Work{
  public int WorkId { get; set; }
  public virtual Work RelatedWork { get; set; }
  public virtual ICollection&lt;Work&gt; RelatedMultipleWorks { get; set; }
  }
  </code></pre>
  
  <p>I'm generating an Work object like this :</p>
  
  <pre><code>Work myWork = new Work();
  
  work mywork2 = new Work();
  work mywork3 = new Work();
  
  myWork.RelatedMultipleWorks.add(mywork2);
  myWork.RelatedMultipleWorks.add(mywork3);
  </code></pre>
  
  <p>On <code>DbSaveChanges</code>, I get this exception : </p>
  
  <blockquote>
    <p>An entity object cannot be referenced by multiple instances of
    IEntityChangeTracker.</p>
  </blockquote>
  
  <p>What is wrong with the code? How can I fix this? Thanks.</p>
  
  <p>I get the exception at this line :</p>
  
  <pre><code>_db.Works.Add(mywork);
  </code></pre>
  
  <p>Here is my DbSaveChanges Line : </p>
  
  <pre><code>  _db.Works.Add(_myWork);
    _db.SaveChanges();
    result.Success= true;
    _provider.AddOrUpdate(mywork);
  </code></pre>
  
  <p>Note : In the actual code, Work entity has a lot more entities. Like hundreds, so I can't post actual code.</p>
  
  <p><strong>EDIT :</strong> 
  When I try to add myWork2 or myWork3 using <code>_db.Works.Add(_myWork2);</code>, I still get the same error. Is this error because of a missing entity or something like that?</p>