public async Task <ActionResult <ConferenceResponseVho> > GetConferenceByIdVHOAsync(Guid conferenceId) { if (conferenceId == Guid.Empty) { _logger.LogWarning("Unable to get conference when id is not provided"); ModelState.AddModelError(nameof(conferenceId), $"Please provide a valid {nameof(conferenceId)}"); return(BadRequest(ModelState)); } ConferenceDetailsResponse conference; try { conference = await _videoApiClient.GetConferenceDetailsByIdAsync(conferenceId); } catch (VideoApiException e) { _logger.LogError(e, $"Unable to retrieve conference: ${conferenceId}"); return(StatusCode(e.StatusCode, e.Response)); } var exceededTimeLimit = !ConferenceHelper.HasNotPassed(conference.CurrentStatus, conference.ClosedDateTime); if (exceededTimeLimit) { _logger.LogInformation( $"Unauthorised to view conference details {conferenceId} because user is not " + "Officer nor a participant of the conference, or the conference has been closed for over 30 minutes"); return(Unauthorized()); } // these are roles that are filtered against when lists participants on the UI var displayRoles = new List <Role> { Role.Judge, Role.Individual, Role.Representative, Role.VideoHearingsOfficer, Role.JudicialOfficeHolder }; conference.Participants = conference .Participants .Where(x => displayRoles.Contains((Role)x.UserRole)).ToList(); var conferenceResponseVhoMapper = _mapperFactory.Get <ConferenceDetailsResponse, ConferenceResponseVho>(); var response = conferenceResponseVhoMapper.Map(conference); await _conferenceCache.AddConferenceAsync(conference); return(Ok(response)); }