public async Task<ActionResult> Index(ManageMessageId? message, HttpPostedFileBase file)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AvatarFormatError ? "Invalid avatar format."
                : message == ManageMessageId.AvatarSizeError ? "Avatar could not be larger than 5mb."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : message == ManageMessageId.AvatarChangeSuccess ? "Your avatar was successfuly set"
                : "";

            var userId = User.Identity.GetUserId();

            var model = new IndexViewModel
            {
                HasPassword = HasPassword(),
                PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId),
                ImagePath = UserManager.GetUserImagePath(userId)
            };

            return View(model);
        }
        public ActionResult SetAvatar(IndexViewModel model, HttpPostedFileBase file)
        {
            bool success = false;

            if(file.ContentLength > 0 && file != null)
            {
                var user = UserManager.FindById(User.Identity.GetUserId());

                string imagePath = new FileManager().Save(file);
                model.ImagePath = imagePath;

                success = UserManager.ChangeUserAvatar(User.Identity.GetUserId(), imagePath);
            }

            if(success == false)
            {
                return new HttpNotFoundResult();
            }

            return View("Index", model);
        }