.AsNoTracking as you literally track if it exists after
FirstOrDefaultAsync from the loop
/close - otherwise I will mark this as stale and this post will be archived until there is new activity..AsNoTrackingFirstOrDefaultAsync_mainDbContext.WorkItems.Attach(existingWorkItem);
_mainDbContext.Entry(existingWorkItem).State = EntityState.Modified;