private async Task AssignTemplateWithSpecification(SpecificationVersion specificationVersion, string templateVersionId, string fundingStreamId, string fundingPeriodId) { specificationVersion.AddOrUpdateTemplateId(fundingStreamId, templateVersionId); ApiResponse <TemplateMapping> mappingResponse = await _calculationsPolicy.ExecuteAsync(() => _calculations.ProcessTemplateMappings(specificationVersion.SpecificationId, templateVersionId, fundingStreamId)); if (mappingResponse?.StatusCode.IsSuccess() != true) { string message = $"Unable to associate template version {templateVersionId} for funding stream {fundingStreamId} and period {fundingPeriodId} on specification {specificationVersion.SpecificationId}"; LogError(message); throw new InvalidOperationException(message); } }