public async Task <IActionResult> GetApprovedSpecificationsTrimmed(string fundingPeriodId, string fundingStreamId) { Guard.IsNullOrWhiteSpace(fundingPeriodId, nameof(fundingPeriodId)); Guard.IsNullOrWhiteSpace(fundingStreamId, nameof(fundingStreamId)); ApiResponse <IEnumerable <SpecificationSummary> > apiResponse = await _specificationsApiClient.GetApprovedSpecificationsByFundingPeriodIdAndFundingStreamId(fundingPeriodId, fundingStreamId); if (apiResponse.StatusCode == HttpStatusCode.OK) { IEnumerable <SpecificationSummary> specificationSummaries = apiResponse.Content; IEnumerable <SpecificationSummary> specificationSummariesTrimmed = await _authorizationHelper.SecurityTrimList(User, specificationSummaries, SpecificationActionTypes.CanChooseFunding); return(Ok(specificationSummaries.OrderBy(c => c.Name).Select(_ => (_, specificationSummariesTrimmed.Any(trimmedSpec => trimmedSpec.Id == _.Id) == true ? true : false)))); } if (apiResponse.StatusCode == HttpStatusCode.BadRequest) { return(new BadRequestResult()); } return(new StatusCodeResult(500)); }