title: EntityFramework one to many relationship repeated insert problem
body: <pre><code>enter code here
  
  [Table(&quot;Articles&quot;)]
  public class Article : IEntity
  {
      [Required, StringLength(60)]
      public string Title { get; set; }
      public int CategoryId { get; set; }
      [Required, StringLength(2500)]
      public string Text { get; set; }
      public int LinkCount { get; set; }
      public virtual User Owner { get; set; }
      public virtual Category Category { get; set; }
      public virtual Html_Content_Result HtmlPage { get; set; }
      public virtual List&lt;Comment&gt; Comments { get; set; }
      public virtual List&lt;Liked&gt; Likes { get; set; }       
  }
  
      [Table(&quot;Users&quot;)]
  public class User : IEntity
  {
      [StringLength(25)]
      public string Name { get; set; }
      [StringLength(25)]
      public string Lastname { get; set; }
      [StringLength(25), Required]
      public string Username { get; set; }
      [StringLength(100), Required]
      public string Password { get; set; }
      [StringLength(70), Required]
      public string Email { get; set; }
      public bool IsActive { get; set; }
      [Required]
      public Guid ActivateGuid { get; set; }
      public virtual List&lt;Article&gt; Articles { get; set; }
      public virtual List&lt;Comment&gt; Comments { get; set; }
      public virtual List&lt;UsersRole&gt; UsersRoles { get; set; }
      public virtual List&lt;Liked&gt; Likes { get; set; }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/hX1j1.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>I have two entity named User and named Article.
  I created my db with entityframework codefirst.
  There is  one to many relation between this two table.
  Problem is when i insert operation to article table i add to the model  user entity from session and inserted repeated entery on my user table beacuse i already inserted my user before.</p>
  <p>What should i do for solution?</p>