public async Task <IActionResult> GetTournamentAsync(int tournamentId) { try { var UserIdOfTournament = await tournamentRepo.GetAssociatedUserIdForTournamentAsync(tournamentId); // Check if the corresponding team is of that user. if (await CheckIfAuthorized(await GetCurrentUser(), UserIdOfTournament) != false) { // return team with ok code. return(Ok(await tournamentRepo.GetTournamentAsync(tournamentId))); } //not authorized?? or not found?? return(NotFound()); } catch (Exception) { //log?? return(BadRequest()); } }