public async Task <IActionResult> JoinSessionAsync([FromBody] JoinSessionRequest joinSessionRequest, CancellationToken cancellationToken) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var session = await _sessionProvider.GetSessionBySessionCodeAsync(joinSessionRequest.SessionCode, cancellationToken); if (session == null) { return(NotFound()); } var userJoinCheck = await CheckUserCanJoinSessionAsync(session, joinSessionRequest.Nickname, joinSessionRequest.UserId, joinSessionRequest.RejoinCode, cancellationToken); if (userJoinCheck.GetType() != typeof(OkResult)) { return(userJoinCheck); } var response = await _sessionProvider.JoinSessionAsync(joinSessionRequest, session.SessionId, cancellationToken); return(Ok(response)); }