public ActionResult HandleForgottenPassword(ForgottenPasswordViewModel model)
        {
            var membershipService = ApplicationContext.Current.Services.MemberService;

            if (!ModelState.IsValid)
            {
                return CurrentUmbracoPage();
            }

            //Find the member with the email address
            var findMember = membershipService.GetByEmail(model.EmailAddress);

            if (findMember != null)
            {
                //We found the member with that email

                //Set expiry date to
                DateTime expiryTime = DateTime.Now.AddMinutes(15);

                //Lets update resetGUID property
                findMember.Properties["resetGUID"].Value = expiryTime.ToString("ddMMyyyyHHmmssFFFF");

                //Save the member with the up[dated property value
                membershipService.Save(findMember);

                //Send user an email to reset password with GUID in it
                EmailHelper email = new EmailHelper();
                email.SendResetPasswordEmail(findMember.Email, expiryTime.ToString("ddMMyyyyHHmmssFFFF"));
            }
            else
            {
                ModelState.AddModelError("ForgottenPasswordForm.", "No member found");
                return CurrentUmbracoPage();
            }

            TempData["IsSuccessful"] = true;
            return RedirectToCurrentUmbracoPage();
        }
        public ActionResult HandleRegister(RegisterViewModel model)
        {
            var membershipService = ApplicationContext.Current.Services.MemberService;

            if (!ModelState.IsValid)
            {
                return PartialView("RegisterForm", model);
            }

            //Model valid let's create the member
            try
            {
                //Member createMember = Member.MakeNew(model.Name, model.EmailAddress, model.EmailAddress, umbJobMemberType, umbUser);
                // WARNING: update to your desired MembertypeAlias...
                // .CreateMember(string username, string email, string displayName, string memberTypeAlias);
                var createMember = membershipService.CreateMember(model.EmailAddress, model.EmailAddress, model.Name, "Member");

                //Set the verified email to false
                createMember.Properties["hasVerifiedEmail"].Value = false;

                //Save the changes, if we do not do so, we cannot save the password.
                membershipService.Save(createMember);

                //Set password on the newly created member
                membershipService.SavePassword(createMember, model.Password);
            }
            catch (Exception ex)
            {
                //EG: Duplicate email address - already exists
                ModelState.AddModelError("memberCreation", ex.Message);

                return CurrentUmbracoPage();
            }

            //Create temporary GUID
            var tempGUID = Guid.NewGuid();

            //Fetch our new member we created by their email
            var updateMember = membershipService.GetByEmail(model.EmailAddress);

            //Just to be sure...
            if (updateMember != null)
            {
                //Set the verification email GUID value on the member
                updateMember.Properties["emailVerifyGUID"].Value = tempGUID.ToString();

                //Set the Joined Date label on the member
                updateMember.Properties["joinedDate"].Value = DateTime.Now.ToString("dd/MM/yyyy @ HH:mm:ss");

                //Save changes
                membershipService.Save(updateMember);
            }

            //Send out verification email, with GUID in it
            EmailHelper email = new EmailHelper();
            email.SendVerifyEmail(model.EmailAddress, tempGUID.ToString());

            //Update success flag (in a TempData key)
            TempData["IsSuccessful"] = true;

            //All done - redirect back to page
            return CurrentUmbracoPage();
        }