private int RemoveCompletedAuditors(Dictionary <string, Auditor> auditors) { int removeCount = 0; List <string> completedIds = auditors.Where(kvp => kvp.Value.IsCompleted).Select(kvp => kvp.Key).ToList(); List <Auditor> removedAuditors = new List <Auditor>(); foreach (string id in completedIds) { if (auditors.ContainsKey(id)) { var toRemove = auditors[id]; if (auditors.Remove(id)) { removeCount++; removedAuditors.Add(toRemove); } } } if (removeCount > 0) { GameEvents.OnAuditorsRemoved(removedAuditors); } return(removeCount); }