public virtual ActionResult Confirm(string username, string token)
{
if (String.IsNullOrEmpty(token)) return HttpNotFound();
var user = userService.FindByUsername(username);
if (user == null) return HttpNotFound();
string existingEmail = user.EmailAddress;
var model = new EmailConfirmationModel
{
ConfirmingNewAccount = String.IsNullOrEmpty(existingEmail),
SuccessfulConfirmation = userService.ConfirmEmailAddress(user, token)
};
if (!model.ConfirmingNewAccount) messageService.SendEmailChangeNoticeToPreviousEmailAddress(user, existingEmail);
return View("~/Views/Users/Confirm.cshtml", model);
}