public async Task <ActionResult> GetBookingsList(string cursor, int limit = 100) { if (cursor != null) { cursor = _encoder.Encode(cursor); } IEnumerable <string> caseTypes; if (_userIdentity.IsAdministratorRole()) { caseTypes = _userIdentity.GetGroupDisplayNames(); } else { return(Unauthorized()); } try { var types = caseTypes ?? Enumerable.Empty <string>(); var hearingTypesIds = await GetHearingTypesId(types); var bookingsResponse = await _bookingsApiClient.GetHearingsByTypesAsync(hearingTypesIds, cursor, limit); return(Ok(bookingsResponse)); } catch (BookingsApiException e) { if (e.StatusCode == (int)HttpStatusCode.BadRequest) { return(BadRequest(e.Response)); } throw; } }