public async Task CreateIdentityServerUser(string userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentNullException("userId");
            }

            var fullUserStore = UserManager.FullUserStore;
            var user          = await fullUserStore.FindByIdAsync(Guid.Parse(userId));

            if (user == null)
            {
                throw new UserDoesNotExitException();
            }
            var adminStore    = new IdentityServer3AdminStore();
            var idsUserExists = await adminStore.FindDoesUserExistByUserIdAsync(userId);

            if (!idsUserExists)
            {
                var claim = new Claim(ClaimTypes.Role, "Developer");
                await fullUserStore.AddClaimAsync(user, claim);

                var idsUser = new IdentityServerUser()
                {
                    Enabled = true, UserId = userId
                };
                await adminStore.CreateIdentityServerUserAsync(idsUser);
            }
        }
        // GET: Admin/Home/Manage/5
        public async Task <ActionResult> Manage(string id, string email)
        {
            var fullUserStore = UserManager.FullUserStore;
            var claims        = await fullUserStore.GetClaimsAsync(Guid.Parse(id));

            var query = from item in claims
                        where item.Type == ClaimTypes.Role && item.Value == "Developer"
                        select item;

            var adminStore = new IdentityServer3AdminStore();

            ViewBag.Email = email;
            var exists = await adminStore.FindDoesUserExistByUserIdAsync(id);

            if (exists)
            {
                var scopes = await adminStore.FindScopesByUserAsync(id);
            }
            IdentityServerUserModel isum = new IdentityServerUserModel()
            {
                UserId        = id,
                Exists        = exists,
                AllowedScopes = new List <string>(),
                Developer     = query.Any()
            };

            return(View(isum));
        }