private bool FindMissingUsersInDatabase(out List <UserPrincipal> _UsersToBePut, List <UserPrincipal> _Users, Action <string> _ErrorMessageAction) { _UsersToBePut = null; var TmpDictionary = new Dictionary <string, UserPrincipal>(); foreach (var AzureUser in _Users) { TmpDictionary.Add(AzureUser.Email + Controller_SSOAccessToken.EMAIL_USER_NAME_POSTFIX, AzureUser); } if (!DatabaseService.ScanTable( UniqueUserFieldsDBEntry.DBSERVICE_UNIQUEUSERFIELDS_TABLE(), out List <JObject> Result, _ErrorMessageAction)) { _ErrorMessageAction?.Invoke("Scan unique-users-fields operation has failed."); return(false); } foreach (var Existing in Result) { if (Existing.TryGetValue(UniqueUserFieldsDBEntry.KEY_NAME_USER_EMAIL, out JToken ExistingEmailToken) && ExistingEmailToken.Type == JTokenType.String) { TmpDictionary.Remove((string)ExistingEmailToken); //TryRemove } } _UsersToBePut = TmpDictionary.Values.ToList(); return(true); }