title: The instance of entity type 'xTestType' cannot be tracked because another instance of this type with the same key is already being tracked?
body: <p>I'm trying to delete multiple rows from a table. But it gives the following error after the first iteration. I can see primary key <code>Id</code> as <code>0</code> on all the <code>xTestType</code> object. that might be the issue. Why is it always giving <code>Id</code> <code>0</code>.</p>
  
  <pre><code>foreach (var temp in oldxDetails.TestTypes)
  {
    if (deleteTestTypes.Contains(input.Id))
    {
      var xTestType = new xTestType
      {
        xId = xId,
        TestTypeMasterId = temp.Id
      };
  
      await _xTestRepository.DeleteAsync(xTestType);
    }
  }
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <p><code>The instance of entity type 'xTestType' cannot be tracked because another instance of this type with the same key is already being tracked. When adding new entities, for most key types a unique temporary key value will be created if no key is set (i.e. if the key property is assigned the default value for its type). If you are explicitly setting key values for new entities, ensure they do not collide with existing entities or temporary values generated for other new entities. When attaching existing entities, ensure that only one entity instance with a given key value is attached to the context.</code></p>