public async Task <IActionResult> Show(string clientId)
        {
            Client client = await _clientService.Find(clientId);

            if (client == null)
            {
                ViewBag.Message = string.Format("The Auth Central Client with ClientId {0} could not be found.", clientId);
                return(RedirectToAction("Index"));
            }

            var clientClaims = new List <ClaimModel>();

            foreach (Claim claim in client.Claims)
            {
                clientClaims.Add(new ClaimModel(claim));
            }

            var model = new ClientClaimModelContainer()
            {
                ClientId     = client.ClientId,
                ClientClaims = clientClaims
            };

            return(View(model));
        }
        public async Task <IActionResult> Save(ClientClaimModelContainer cmc)
        {
            //TODO: validate??

            Client client = await _clientService.Find(cmc.ClientId);

            if (client == null)
            {
                ViewBag.Message = string.Format("The Auth Central Client with ClientId {0} could not be found.", client.ClientId);
                return(RedirectToAction("Index"));
            }

            bool saveRequired = false;

            foreach (var clientClaim in cmc.ClientClaims)
            {
                if (!string.IsNullOrWhiteSpace(clientClaim.Type) &&
                    !string.IsNullOrWhiteSpace(clientClaim.Value))
                {
                    client.Claims.Add(new Claim(clientClaim.Type, clientClaim.Value));
                    saveRequired = true;
                }
            }

            if (saveRequired)
            {
                await _clientService.Save(client);
            }

            return(RedirectToAction("Show", new { clientId = client.ClientId }));
        }