public async Task <IActionResult> InvitePlayer([FromBody] InviteRequest request)
        {
            var currentUser = await _userManager.FindByNameAsync(User.Identity.Name);

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var league = await _fantasyCriticService.GetLeagueByID(request.LeagueID);

            if (league.HasNoValue)
            {
                return(BadRequest());
            }

            if (league.Value.LeagueManager.UserID != currentUser.UserID)
            {
                return(Unauthorized());
            }

            foreach (var year in league.Value.Years)
            {
                var leagueYear = await _fantasyCriticService.GetLeagueYear(league.Value.LeagueID, year);

                if (leagueYear.Value.PlayStatus.PlayStarted)
                {
                    return(BadRequest("You can't add a player to a league that has already started playing"));
                }
            }

            FantasyCriticUser inviteUser = await _userManager.FindByEmailAsync(request.InviteEmail);

            if (inviteUser is null)
            {
                string baseURL = $"{Request.Scheme}://{Request.Host.Value}";
                await _emailSender.SendInviteEmail(request.InviteEmail, league.Value, baseURL);
            }

            Result result = await _fantasyCriticService.InviteUser(league.Value, request.InviteEmail);

            if (result.IsFailure)
            {
                return(BadRequest(result.Error));
            }

            return(Ok());
        }