public bool CheckOrCreateUserRecord(IUser user) { bool isSuccess = false; bool existsInCache = false; string userName = user.Username; int userId = user.DiscriminatorValue; if ((existsInCache = IsUserRecordExistCache(userId)) || CheckUserRecordExists(userId) || (CreateNewUserRecord(userId, userName)) ) { isSuccess = true; } if (!existsInCache && isSuccess) { UserRecordExistenceSet.Add(userId); } return(isSuccess); }
private bool IsUserRecordExistCache(int userId) { return(UserRecordExistenceSet.Contains(userId)); }