public async Task <IActionResult> RemovePlayer([FromBody] PlayerRemoveRequest 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());
            }

            if (league.Value.LeagueManager.UserID == request.UserID)
            {
                return(BadRequest("Can't remove the league manager."));
            }

            var removeUser = await _userManager.FindByIdAsync(request.UserID.ToString());

            if (removeUser == null)
            {
                return(BadRequest());
            }

            var playersInLeague = await _fantasyCriticService.GetUsersInLeague(league.Value);

            bool userIsInLeague = playersInLeague.Any(x => x.UserID == removeUser.UserID);

            if (!userIsInLeague)
            {
                return(BadRequest("That user is not in that league."));
            }

            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 remove a player from a league that has already started playing"));
                }
            }

            await _fantasyCriticService.RemovePlayerFromLeague(league.Value, removeUser);

            return(Ok());
        }
    public async Task <IActionResult> RemovePlayer([FromBody] PlayerRemoveRequest request)
    {
        var leagueRecord = await GetExistingLeague(request.LeagueID, RequiredRelationship.LeagueManager);

        if (leagueRecord.FailedResult is not null)
        {
            return(leagueRecord.FailedResult);
        }
        var validResult = leagueRecord.ValidResult !;
        var league      = validResult.League;

        if (league.LeagueManager.Id == request.UserID)
        {
            return(BadRequest("Can't remove the league manager."));
        }

        var removeUser = await _userManager.FindByIdAsync(request.UserID.ToString());

        if (removeUser == null)
        {
            return(BadRequest());
        }

        var playersInLeague = await _leagueMemberService.GetUsersInLeague(league);

        bool userIsInLeague = playersInLeague.Any(x => x.Id == removeUser.Id);

        if (!userIsInLeague)
        {
            return(BadRequest("That user is not in that league."));
        }

        await _leagueMemberService.FullyRemovePlayerFromLeague(league, removeUser);

        return(Ok());
    }