public async Task <IActionResult> Register([FromBody] RegisterViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(new { errorMessage = GetModelStateErrors() }));
                }

                var user = await _userManager.FindByNameAsync(model.Username);

                if (user != null)
                {
                    return(BadRequest(new { errorMessage = "Username is already in use" }));
                }

                var result = _userManager.CreateAsync(new ClassicGuildBankUser()
                {
                    UserName = model.Username,
                    Email    = model.Email,
                }, model.Password).Result;

                if (!result.Succeeded)
                {
                    return(BadRequest(new { errorMessage = result.Errors.First().Description }));
                }

                var addedUser = _userManager.FindByNameAsync(model.Username).Result;

                var token = await _userManager.GenerateEmailConfirmationTokenAsync(addedUser);

                var safeToken = HttpUtility.UrlEncode(token);

                _sendGridService.SendEmailConfirmationEmail(addedUser, safeToken);

                if (!String.IsNullOrEmpty(model.GuildToken))
                {
                    var member = _guildBankRepository.AddGuildMember(model.GuildToken, addedUser);
                    if (member == null)
                    {
                        return(Ok(new { warningMessage = "Failed to add guild member. No Guild Found with provided token" }));
                    }
                }

                return(Ok());
            }
            catch
            {
                return(BadRequest(new { errorMessage = "Failed to Register User" }));
            }
        }