public async Task <ActionResult> RegisterUserPostAsync([FromBody] InputModel inputModel)
        {
            if (inputModel == null)
            {
                var err = new Dictionary <string, string>();
                err.Add("error", "Invalid request");
                return(new BadRequestObjectResult(err));
            }

            // check it's a valid team and the user doesn't already exist
            var teamExists = await _teamService.TeamExists(inputModel.TeamId);

            if (!teamExists)
            {
                var err = new Dictionary <string, string>();
                err.Add("error", "Team does not exist");
                return(new BadRequestObjectResult(err));
            }

            var user = new IdentityUser {
                UserName = inputModel.Email, Email = inputModel.Email
            };
            var result = await _userManager.CreateAsync(user, inputModel.Password);

            if (result.Succeeded)
            {
                _logger.LogInformation("User created a new account with password.");
                await _signInManager.SignInAsync(user, isPersistent : false);
            }

            var errors = "";

            foreach (var error in result.Errors)
            {
                errors = errors + " " + error.Description;
            }

            if (!string.IsNullOrEmpty(errors))
            {
                var err = new Dictionary <string, string>();
                err.Add("error", errors);
                return(new BadRequestObjectResult(err));
            }

            var newUser = await _participantService.CreateNewParticipant(
                new Participant
            {
                ParticipantName = inputModel.Name,
                TeamId          = inputModel.TeamId,
                IdentityUser    = user
            }
                );

            var response = new LoginModel
            {
                Success = true,
            };

            return(new OkObjectResult(response));
        }