public void AddUser(UserDto userDto) { var id = _users.Count + 1; id = ValidateUniqueId(id); var user = new User(id, userDto.UserName, userDto.Password, userDto.EmailAdress); bool usernameOkay = UserValidation.ValidateUsername(userDto.UserName); if (!usernameOkay) { throw new InvalidCharacters(); } if (UserNameIsUnique(user.UserName)) { throw new NonUniqueUserName(); } if (_users.ContainsKey(user.UserId)) { throw new NonUniqueId(); } _users.Add(id, user); }