/// <summary>
        /// Removes an IdentitClaim from user
        /// </summary>
        /// <typeparam name="TClaim"></typeparam>
        /// <typeparam name="TUser"></typeparam>
        /// <param name="manager"></param>
        /// <param name="user"></param>
        /// <param name="claim"></param>
        /// <returns></returns>
        public static IdentityResult RemoveClaim <TClaim, TUser>(this UserManagerEx <TUser> manager,
                                                                 TUser user, TClaim claim)
            where TClaim : IdentityClaim
            where TUser : IdentityUser
        {
            if (manager == null)
            {
                throw new ArgumentNullException(IdentityConstants.Manager);
            }

            return(AsyncHelper.RunSync <IdentityResult>(() => manager.RemoveClaimAsync(user, claim)));
        }
        /// <summary>
        /// Adds a user to an IdentityRole
        /// </summary>
        /// <typeparam name="TRole"></typeparam>
        /// <typeparam name="TUser"></typeparam>
        /// <param name="manager"></param>
        /// <param name="user"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        public static IdentityResult AddToRole <TRole, TUser>(this UserManagerEx <TUser> manager,
                                                              TUser user, TRole role)
            where TRole : IdentityRole
            where TUser : IdentityUser
        {
            if (manager == null)
            {
                throw new ArgumentNullException(IdentityConstants.Manager);
            }

            return(AsyncHelper.RunSync <IdentityResult>(() => manager.AddToRoleAsync(user, role)));
        }
        /// <summary>
        /// Gets the claims of a user as list of IdentityClaim
        /// </summary>
        /// <typeparam name="TUser"></typeparam>
        /// <param name="manager"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static List <IdentityClaim> GetClaimsEx <TUser>(this UserManagerEx <TUser> manager,
                                                               TUser user)
            where TUser : IdentityUser
        {
            if (manager == null)
            {
                throw new ArgumentNullException(IdentityConstants.Manager);
            }

            var result = AsyncHelper.RunSync <IdentityUserClaimList>(() => manager.GetClaimsAsyncEx(user));

            return(result.List);
        }