title: Entity framework inserts new record to navigation table inappropriately
body: <p>I'm facing an issue when inserting records with Many to Many navigation property, </p>
  
  <p>I have these models</p>
  
  <pre><code>//ModelBase
  public class ModelBase
  {
      [Key]
      public long Id { get; set; }
  }
  
  //Book
  public class Book : ModelBase
  {
      public string Title { get; set; }
      public virtual ICollection&lt;Author&gt; Authors { get; set; }
      public virtual ICollection&lt;PublishedBook&gt; PublishedBooks { get; set; }
  }
  
  //Author
  public class Author : ModelBase
  {
      public string Name { get; set; }
      public virtual ICollection&lt;Book&gt; Books { get; set; }
  }
  </code></pre>
  
  <p>And DTOs called <code>BookDto</code> and  <code>AuthorDto</code> for transfer data between layers</p>
  
  <p>From the controller I fill data to DTOs and call <code>Create</code> method (which is in separate layer) to Save data to database,</p>
  
  <pre><code>BookDto bookDto = new BookDto()
  {
      Id = model.Id,
      Title = model.Title,
      Authors = model.AuthorIds.Select(c =&gt; new AuthorDto { Id = c }).ToList()
  }
  
  using (ServiceFactory facory = new ServiceFactory())
  {
      factory.Book.Create(bookDto);
  }
  </code></pre>
  
  <p>In the <code>Create</code> method I map DTOs with POCOs using ValueInjector</p>
  
  <pre><code>public void Create(BookDto bookDTO)
  {
      Book book = new Book();
      book.InjectFrom&lt;DeepCloneInjection&gt;(bookDTO);
      bookRepository.Add(book);
      unitOfWork.Commit();
  }
  </code></pre>
  
  <p>And it calls <code>Add</code> method in Genaric Repository Base</p>
  
  <pre><code>public virtual void Add(T entity)
  {
      dbset.Add(entity);
  }
  </code></pre>
  
  <p>This inserts data to <code>Books</code> table and <code>BookAuthors</code> tables appropriately BUT inserts new record into the <code>Authors</code> table even if I pass <code>Authors</code> which has existing <code>AuthorIds</code> for <code>Book.Authors</code> from the controller.</p>
  
  <p>Any Idea how to fix this?</p>