public bool CreateUser(string username, string password, string name, string surname, string email)
        {
            if (String.IsNullOrEmpty(username)) throw new ArgumentException("Value cannot be null or empty.", "userName");
            if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password");
            if (String.IsNullOrEmpty(name)) throw new ArgumentException("Value cannot be null or empty.", "name");
            if (String.IsNullOrEmpty(surname)) throw new ArgumentException("Value cannot be null or empty.", "surname");
            if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email");

            username = username.ToLowerInvariant();
            using (var database = _createDatabaseContext())
            {
                var user = new User
                {
                    Username = username,
                    Password = _passwordService.GetSaltedHash(password, username),
                    Name = name,
                    Surname = surname,
                    Email = email
                };
                database.Users.Add(user);
                try
                {
                    database.SaveChanges();
                }
                catch (UpdateException)
                {
                    return false;
                }
            }

            return true;
        }
 public static bool SendForgotPasswordEmail(User user, string token)
 {
     bool result = true;
     try
     {
         var passwordLink = MembershipHelper.GetBaseUrl() +
           "Home/ResetPassword?digest=" +
           HttpUtility.UrlEncode(Encoding.UTF8.GetBytes(token));
         var mail = new SmtpHtmlMailHelper(Resources.Email_PasswordReset_Title);
         mail.Body(Resources.Email_PasswordReset_Body + "<a href='" + passwordLink + "'>" + passwordLink + "</a>");
         mail.Send(new MailMessage("*****@*****.**", user.Email));
     }
     catch (Exception)
     {
         result = false;
     }
     return result;
 }