title: The instance of entity type cannot be tracked on saving data to multiple table
body: <p>Here I am trying to save the person detail in <code>Person</code> table and person related file to <code>PersonFileUpload</code> table on single submit.<br><br>But on submit it shows error saying <code>'The instance of entity type 'PersonFileUpload' cannot be tracked because another instance with the same key value for {'FileId'} is already being tracked. </code> in line <code>uow.Repository&lt;Person&gt;().Add(person);</code>.<br><br>Below is my code and Table structure<br><br></p>
  <pre><code> public Person PersonModel { get; set; } = new Person();
      IReadOnlyList&lt;IBrowserFile&gt; selectedFiles;
      public void postPerson()
      {
          List&lt;PersonFileUpload&gt; fileList = new List&lt;PersonFileUpload&gt;();
          foreach (var file in selectedFiles)
          {               
              fileList.Add(new PersonFileUpload() { UploadedFileName = file.Name });
              
          }
          PersonModel.PersonFileUpload = fileList;
          mainService.SavePerson(PersonModel);           
      }
  </code></pre>
  <br>
  <pre><code>public void SavePerson(Person person)
      {
          if (person.PersonId == 0)
          {
              uow.Repository&lt;Person&gt;().Add(person);
              uow.Commit();
          }
          else
          {
              uow.Repository&lt;Person&gt;().Edit(person);
              uow.Commit();
          }
      }
  </code></pre>
  <p>Person Table</p>
  <pre><code>public partial class Person
  {
      public Person()
      {
          PersonFileUpload = new HashSet&lt;PersonFileUpload&gt;();
      }
  
      public int PersonId { get; set; }
      public string FullName { get; set; }
      public string Email { get; set; }
      public string Address { get; set; }
      public int? CountryId { get; set; }
      public int? CityId { get; set; }
      public virtual ICollection&lt;PersonFileUpload&gt; PersonFileUpload { get; set; }
  }
  </code></pre>
  <p><br>PersonFileUpload table</p>
  <pre><code>public partial class PersonFileUpload
  {
      public int FileId { get; set; }
      public int? PersonId { get; set; }
      public string UploadedFileName { get; set; }
      public virtual Person Person { get; set; }
  }
  </code></pre>