protected override void Dispose(bool disposing)
 {
     if (disposing && CustomUserManager != null)
     {
         CustomUserManager.Dispose();
         CustomUserManager = null;
     }
     base.Dispose(disposing);
 }
        private async Task SignInAsync(ApplicationUser user, bool isPersistent)
        {
            AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

            var identity = await CustomUserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);

            AuthenticationManager.SignIn(new AuthenticationProperties()
            {
                IsPersistent = isPersistent
            }, identity);
        }
 public AccountController()
 {
     CustomUserManager = new CustomUserManager();
 }