private ClientUser ValidateUserLogin(string userName, string password) { if (!_storageHandler.UserNameExists(userName)) { throw new UserNotRegisteredException($"Account with user name '{userName}' is not registered. Please check if you entered correct user name for your account or choose option 'Registration required' to create new account."); } ClientUser user = _storageHandler.GetUserByUserName(userName); if (_storageHandler.ValidatePassword(user, password)) { return(user); } throw new WrongUserPasswordException($"You entered wrong password for account with user name '{userName}'. Please try again."); }