title: Can't update database with EF Core AddRange
body: <p>I am getting the following error with the code below:</p>
  <ul>
  <li>I am declaring my repository with AddScoped in my restful api when I use this. Still does not work. (services.AddScoped&lt;ICampRepository, CampRepository&gt;();)</li>
  <li>I have tried using AsNoTracking(), but SaveChanges does not work. Even when I tell EF that the state has change, I get the same error all over again.</li>
  </ul>
  <p><strong>The instance of entity type 'ConferenceRoom' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.</strong></p>
  <pre><code>        public async Task&lt;bool&gt; AddRangeTalksAsync(List&lt;Talk&gt; talksToBulkInsert, string moniker)
          {
              try
              {
                  IQueryable&lt;Camp&gt; query = _context.Camps.Where(c =&gt; c.Moniker == moniker);
  
                  Camp camp = await query.FirstOrDefaultAsync();
  
                  camp.Talks.AddRange(talksToBulkInsert);
  
                  await _context.SaveChangesAsync();
  
                  return true;
              }
              catch (Exception ex)
              {
                  return false;
              }
          }
  </code></pre>
  <p>Below is a sample of list of objects that I am trying to insert. One works, but any more than one does not work.</p>
  <pre><code>[
     {
        &quot;id&quot;: 0,
        &quot;campId&quot;: 0,
        &quot;title&quot;: &quot;Talk for 'CompuGen Core Code Camp #4' for conference room 'Conference Room #1' for day 1 hour 1&quot;,
        &quot;abstract&quot;: &quot;This talk is interesting, you will like it.&quot;,
        &quot;level&quot;: 1,
        &quot;food&quot;: &quot;Bread&quot;,
        &quot;beverage&quot;: &quot;Water&quot;,
        &quot;swag&quot;: &quot;Talk T-Shirt and a notebook&quot;,
        &quot;startTime&quot;: &quot;2022-01-03T08:00:00&quot;,
        &quot;endTime&quot;: &quot;2022-01-03T09:00:00&quot;,
        &quot;conferenceRoom&quot;: {
           &quot;id&quot;: 307,
           &quot;campId&quot;: 34,
           &quot;conferenceRoomName&quot;: &quot;Conference Room #1&quot;,
           &quot;conferenceRoomCapacity&quot;: 56
        },
        &quot;talkSpeakers&quot;: [],
        &quot;talkAttendees&quot;: [],
        &quot;ratings&quot;: []
     },
  {
        &quot;id&quot;: 0,
        &quot;campId&quot;: 0,
        &quot;title&quot;: &quot;Talk for 'CompuGen Core Code Camp #4' for conference room 'Conference Room #1' for day 1 hour 2&quot;,
        &quot;abstract&quot;: &quot;This talk is interesting, you will like it.&quot;,
        &quot;level&quot;: 1,
        &quot;food&quot;: &quot;Bread&quot;,
        &quot;beverage&quot;: &quot;Water&quot;,
        &quot;swag&quot;: &quot;Talk T-Shirt and a notebook&quot;,
        &quot;startTime&quot;: &quot;2022-01-03T08:00:00&quot;,
        &quot;endTime&quot;: &quot;2022-01-03T09:00:00&quot;,
        &quot;conferenceRoom&quot;: {
           &quot;id&quot;: 307,
           &quot;campId&quot;: 34,
           &quot;conferenceRoomName&quot;: &quot;Conference Room #1&quot;,
           &quot;conferenceRoomCapacity&quot;: 56
        },
        &quot;talkSpeakers&quot;: [],
        &quot;talkAttendees&quot;: [],
        &quot;ratings&quot;: []
     }
  ]
  </code></pre>
  <p>Also, the database schema looks like this from the entities I created in EF CORE.</p>
  <p><a href="https://i.stack.imgur.com/Ypxo6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ypxo6.png" alt="Database Schema for the Core Code Camp Conference Scheduling System" /></a></p>
  <p>What I am looking for, is to how to keep this schema intact, and be able to create multiple conference rooms for a Camp in one go, but this does not work.</p>