public UserViewModel LogIn(string username, string password)
        {
            var matchedUser = _userRepository.GetUserByName(username);

            if (matchedUser == null)
            {
                return(new UserViewModel());
            }
            if (!matchedUser.PasswordHash.Equals(PasswordEncoder.EncodePasswordMd5(password)))
            {
                return(new UserViewModel());
            }
            if (matchedUser.Id != null)
            {
                return(_mapper.Map <UserViewModel>(matchedUser));
            }
            var guidString = System.Guid.NewGuid().ToString();

            matchedUser.Id = guidString;
            _userRepository.AddOrUpdateUser(matchedUser);
            return(_mapper.Map <UserViewModel>(matchedUser));
        }