private async Task <(string userId, ClubResource addedClub1, ClubResource addedClub2)> SetUpPostFeed(
            ClubSystemDbContext dbContext)
        {
            var clubRepository = new ClubRepository(dbContext);

            var clubDto1 = new ClubDto {
                Name = "Name1", UniversityName = "University1"
            };
            var clubDto2 = new ClubDto {
                Name = "Name2", UniversityName = "University2"
            };
            var          addedClub1 = clubRepository.AddClub(clubDto1);
            var          addedClub2 = clubRepository.AddClub(clubDto2);
            const string userId     = "1234";

            var claimsPrincipal = GenerateClaimsPrincipalWithId(userId);

            var addUserToClubDto1 = new AddUserToClubDto {
                ClubId = addedClub1.Id
            };
            var addUserToClubDto2 = new AddUserToClubDto {
                ClubId = addedClub2.Id
            };
            await clubRepository.AddUserToClub(addUserToClubDto1, claimsPrincipal);

            await clubRepository.AddUserToClub(addUserToClubDto2, claimsPrincipal);

            return(userId, addedClub1, addedClub2);
        }
        public async Task <ClubResource> AddUserToClub(AddUserToClubDto addUserToClubDto,
                                                       ClaimsPrincipal claimsPrincipal)
        {
            var userId = claimsPrincipal.FindFirst(JwtRegisteredClaimNames.Sub)?.Value;
            var club   = await _context.Clubs.FindAsync(addUserToClubDto.ClubId);

            club.UserClubs.Add(new UserClub {
                UserId = userId
            });
            await _context.SaveChangesAsync();

            var clubResource = _mapper.Map <ClubResource>(club);

            return(clubResource);
        }
        public async Task <IActionResult> AddUserToClub([FromBody] AddUserToClubDto addUserToClubDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _clubRepository.AddUserToClub(addUserToClubDto, User);

            if (result.Members.Any(member => member == User.FindFirst(JwtRegisteredClaimNames.Sub)?.Value))
            {
                return(Ok(result));
            }
            return(BadRequest(ModelState));
        }