title: SaveChangesAsync() is hanging in EF Core 3.1
body: <p>VS 2019 ASP.NET Core 3.1 EF Core 3.1 Web API</p>
  
  <p>I have the following table structure in my SQL database:</p>
  
  <p><a href="https://i.stack.imgur.com/qg7Fy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qg7Fy.png" alt="enter image description here"></a></p>
  
  <p>I allow users to "edit" the template (change actions/groups).  When they save, I delete all of the children of the template and re-add the new children (passed in a DTO class).  The code is:</p>
  
  <pre><code>   var now = DateTime.UtcNow;
  
      var template = await _context.Template
          .Include(t =&gt; t.TemplateCell)
          .Include(t =&gt; t.TemplateGroup)
          .ThenInclude(t =&gt; t.TemplateCell)
          .Include(t =&gt; t.TemplateAction)
          .ThenInclude(t =&gt; t.TemplateCell)
          .FirstOrDefaultAsync(t =&gt; t.Id == dto.Id);
  
      // Updates the templates details
      template.Name = dto.Name;
      template.Description = dto.Description;
      template.InitialRisk = dto.InitialRisk;
      template.ModifiedWhen = now;
      template.ModifiedByUserId = user.Id;
  
      // Clear the old children
      template.TemplateCell
          .Clear();
      template.TemplateAction
          .Clear();
      template.TemplateGroup
          .Clear();
  
      // Add the new children
      int sortOrder = 0;
      foreach (var groupName in dto.GroupNames)
      {
          template.TemplateGroup
              .Add(new TemplateGroup
              {
                  Name = groupName,
                  SortOrder = sortOrder++
              });
      }
  
      sortOrder = 0;
      foreach (var actionName in dto.ActionNames)
      {
          template.TemplateAction
              .Add(new TemplateAction
              {
                  Name = actionName,
                  SortOrder = sortOrder++
              });
      }
  
      int cellIndex = 0;
      foreach (var group in template.TemplateGroup)
          foreach (var action in template.TemplateAction)
              template.TemplateCell
                   .Add(new TemplateCell
                   {
                       TemplateGroup = group,
                       TemplateAction = action,
                       IsEnabled = dto.Cells[cellIndex++]
                   });
  
      await _context.SaveChangesAsync();  // Does not seem to ever return from here?
  
      return template.Id;
  </code></pre>
  
  <p>It get's as far as the await _context.SaveChangesAsync() and never seems to return from that method.  SQL Profiler shows no activity.</p>
  
  <p>Can anyone see what may be causing the issue?</p>