public void ChangeUserPassword(int userId, string newPassword) { Require.Positive(userId, nameof(userId)); Require.NotEmpty(newPassword, nameof(newPassword)); var user = _userRepository.GetAccount(userId); var accountExists = user != null; if (!accountExists) { throw new AccountNotFoundException(); } _passwordManager.UpdateUserPassword(userId, newPassword); var requestToDelete = _passwordManager.GetPasswordChangeRequest(userId); if (requestToDelete != null) { _passwordManager.DeletePasswordChangeRequest(requestToDelete); } }