public ActionResult Edit(User user)
        {
            if (ModelState.IsValid)
            {

                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();

                // log modify action
                var userId = WebSecurity.GetUserId(User.Identity.Name);
                // AuditController.AuditEntry(userId, user.UserID, AuditController.MODIFY_USER);                   // AUDIT

                return RedirectToAction("Index");
            }
            return View(user);
        }
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                // Create a local login before signing in the user
                var user = new User(model.UserName);
                var result = await IdentityManager.Users.CreateLocalUserAsync(user, model.Password);
                if (result.Success)
                {
                    await IdentityManager.Authentication.SignInAsync(AuthenticationManager, user.Id, isPersistent: false);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        /*
         *  METHOD      : AuditEntry
         *  DESCRIPTION :
         *      Check the previous account user and new account user information,
         *      record the differences.  Checks to see if PASSWORD, Securitylevel, or
         *      Email has changed.
         *  PARAMETERS  :
         *      int userId      : user logged in
         *      User oldUser    : previous user
         *      User newUser    : new user
         *      bool isCompare  : (previously used) comparing factor
         *  RETURNS     :
         *      bool ret        : Once finished adding audit entry, return false.
         */
        public static bool AuditEntry(int userId, User oldUser, User newUser, bool isCompare = false)
        {
            bool ret = false;
            if (!oldUser.Equals(newUser))
            {
                if (oldUser.pword != newUser.pword)
                {

                    AuditEntry(userId, oldUser.UserID, MODIFY_USER, "pword", oldUser.pword.ToString(), newUser.pword.ToString());

                }
                if (oldUser.Securitylevel != newUser.Securitylevel)
                {
                    AuditEntry(userId, oldUser.UserID, MODIFY_USER, "Securitylevel", oldUser.Securitylevel.ToString(), newUser.Securitylevel.ToString());

                }
                if (oldUser.Email != newUser.Email)
                {
                    AuditEntry(userId, oldUser.UserID, MODIFY_USER, "Email", oldUser.Email.ToString(), newUser.Email.ToString());

                }
            }
            return ret;
        }