public async Task <SurveyLinkViewModel> SurveyLinkBuilder(OutcomeViewModel model)
        {
            var jsonParser            = new JourneyJsonParser(model.JourneyJson);
            var businessApiPathwayUrl = _configuration.GetBusinessApiPathwayIdUrl(jsonParser.LastPathwayNo, model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age);
            var response = await _restfulHelper.GetAsync(businessApiPathwayUrl);

            var pathway = JsonConvert.DeserializeObject <Pathway>(response);

            return(new SurveyLinkViewModel()
            {
                DispositionCode = model.Id,
                DispositionDateTime = model.DispositionTime,
                EndPathwayNo = (pathway != null) ? pathway.PathwayNo : string.Empty,
                EndPathwayTitle = (pathway != null) ? pathway.Title : string.Empty,
                JourneyId = model.JourneyId.ToString(),
                PathwayNo = model.PathwayNo,
                DigitalTitle = model.DigitalTitle
            });
        }
        public async Task <SurveyLinkViewModel> SurveyLinkBuilder(OutcomeViewModel model)
        {
            var jsonParser            = new JourneyJsonParser(model.JourneyJson);
            var businessApiPathwayUrl = _configuration.GetBusinessApiPathwayIdUrl(jsonParser.LastPathwayNo, model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age);
            var response = await _restClient.ExecuteAsync <Pathway>(new JsonRestRequest(businessApiPathwayUrl, Method.GET));

            CheckResponse(response);

            var pathway         = response.Data;
            var resultingDxCode = model.Is999Callback ? FromOutcomeViewModelToDosViewModel.DispositionResolver.Remap(model.Id) : model.Id;
            var result          = new SurveyLinkViewModel
            {
                DispositionCode             = model.Id,
                DispositionDateTime         = model.DispositionTime,
                EndPathwayNo                = (pathway != null) ? pathway.PathwayNo : string.Empty,
                EndPathwayTitle             = (pathway != null) ? pathway.Title : string.Empty,
                JourneyId                   = model.JourneyId.ToString(),
                SessionId                   = model.SessionId,
                PathwayNo                   = model.PathwayNo,
                DigitalTitle                = model.DigitalTitle,
                Campaign                    = model.Campaign,
                CampaignSource              = model.Source,
                ValidationCallbackOffered   = model.HasAcceptedCallbackOffer.HasValue,
                GuidedSelection             = GetGuidedSelectionParameterFrom(model),
                RecommendedServiceTypeAlias = ServiceViewModel.GetServiceTypeAliasValue(model),
                StartUrl                    = model.StartParameter
            };

            var isPharmacyPathway = result.EndPathwayNo == "PW1827";

            result.SurveyId = isPharmacyPathway ? _surveyLinkFeature.PharmacySurveyId : _surveyLinkFeature.SurveyId;
            AddServiceInformation(model, result);

            model.SurveyLink = result;
            AddEmbeddedDataInformation(model, result);

            return(result);
        }