public bool ValidateUser(string userName, string password)
        {
            var user = _userService.GetUserByLogin(userName);

            return(user == null
                       ? false
                       : _passwordHelperService.ComparePassword(password, user.Password));
        }
        private string changePassword(IUser user, string oldPassword, string newPassword)
        {
            Notification notification = _validator.Validate(newPassword);

            if (!notification.IsValid())
            {
                throw new Exception(notification.AllMessages.FirstOrDefault().ToString());
            }

            if (user.Password.IsEmpty())
            {
                return(_passwordHelperService.CreatePassword(newPassword));
            }

            if (_passwordHelperService.ComparePassword(oldPassword, user.Password))
            {
                return(_passwordHelperService.CreatePassword(newPassword));
            }

            throw new Exception("Password provided did not match the current password");
        }