public async Task <bool> AssignRole(string email, string role)
        {
            bool result = false;

            try
            {
                var cogUser = await _userManager.FindByEmailAsync(email);

                var identityResult = await _userManager.AddToRoleAsync(cogUser, role);

                result = identityResult.Succeeded;
                if (identityResult.Errors?.Any() ?? false)
                {
                    _loggingService.LogEvent(
                        LogType.WARNING,
                        $"{nameof(IdentityService)}.{nameof(AssignRole)}",
                        string.Join("\n", identityResult.Errors.Select(e => $"{e.Code} - {e.Description}")));
                }
            }
            catch (Exception ex)
            {
                _loggingService.LogEvent(ex);
            }
            return(result);
        }
        public async Task <IActionResult> OnPostToggleRedRoleAsync()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToPage("/Cognito", new { message = "You need to be logged in to toggle your red role" }));
            }

            var user = await userManager.GetUserAsync(User);

            if (await userManager.IsInRoleAsync(user, "red"))
            {
                await userManager.RemoveFromRoleAsync(user, "red");

                return(RedirectToPage("/Cognito", new { message = "No longer in the red role. You will no longer be able to play the red game when you next log in." }));
            }
            else
            {
                await userManager.AddToRoleAsync(user, "red");

                return(RedirectToPage("/Cognito", new { message = "Your now in the red role! Relog to play the red game." }));
            }
        }