public static void CreateAccount(MembershipModel model, string userName)
        {
            // Handle the member profile
            MemberProfile profile = MemberProfile.GetProfile(userName);

            Regex phoneRegex = new Regex(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$");

            profile.FirstName = model.FirstName;
            profile.LastName = model.LastName;
            profile.Address = model.Address;
            profile.City = model.City;
            profile.State = model.State;
            profile.Zip = model.Zip;
            profile.Phone = phoneRegex.Replace(model.Phone, "($1) $2-$3");
            profile.ExpirationDate = DateTime.Now.AddMonths(model.Term);
            profile.AmountDue = new HealthManager().CalculateFeeForMembership(model.Term, model.PlanNumber);
            profile.Save();

            // Add them to the members role.
            Roles.AddUserToRole(userName, "Member");
        }
        public ActionResult AddPlan(MembershipModel model)
        {
            AccountManager.CreateAccount(model, User.Identity.Name);
            AccountModel acct = AccountManager.GetAccountByUsername(User.Identity.Name);

            // Construct email
            StringBuilder emailBody = new StringBuilder();
            emailBody.AppendFormat("Hello {0} {1},<br /><br />", model.FirstName, model.LastName);
            emailBody.AppendFormat("On {0}, you registered for a Mystic Health {1} membership.",
                DateTime.Now.ToShortDateString(), _healthManager.GetPlanName(model.PlanNumber));
            emailBody.AppendFormat("As such, you must pay {0:C} dollars in fees via check.<br /><br />", acct.AmountDue);
            emailBody.AppendFormat("Best Regards,<br />Mystic Health.");

            // Send email
            EmailManager.SendEmailMessage(
                acct.Email,
                "*****@*****.**",
                "Membership registration payment",
                emailBody.ToString()
            );

            return RedirectToAction("Profile", "Account");
        }