public async Task <AssessorPage> GetPage(Guid applicationId, int sequenceNumber, int sectionNumber, string pageId)
        {
            AssessorPage page = null;

            if (_assessorSequenceService.IsValidSequenceNumber(sequenceNumber))
            {
                var qnaSection = await _qnaApiClient.GetSectionBySectionNo(applicationId, sequenceNumber, sectionNumber);

                var qnaPage = qnaSection?.QnAData.Pages.FirstOrDefault(p => p.PageId == pageId || string.IsNullOrEmpty(pageId));

                if (qnaPage != null)
                {
                    page = qnaPage.ToAssessorPage(_assessorLookupService, applicationId, sequenceNumber, sectionNumber);

                    var nextPageAction = await _qnaApiClient.SkipPageBySectionNo(page.ApplicationId, page.SequenceNumber, page.SectionNumber, page.PageId);

                    if (nextPageAction != null && NextAction.NextPage.Equals(nextPageAction.NextAction, StringComparison.InvariantCultureIgnoreCase))
                    {
                        page.NextPageId = nextPageAction.NextActionId;
                    }
                }
            }

            return(page);
        }
        public async Task <AssessorPage> GetPage(Guid applicationId, int sequenceNumber, int sectionNumber, string pageId)
        {
            AssessorPage page = null;

            if (_assessorSequenceService.IsValidSequenceNumber(sequenceNumber))
            {
                if (sequenceNumber == RoatpWorkflowSequenceIds.DeliveringApprenticeshipTraining &&
                    sectionNumber == RoatpWorkflowSectionIds.DeliveringApprenticeshipTraining.ManagementHierarchy &&
                    pageId == RoatpWorkflowPageIds.DeliveringApprenticeshipTraining.ManagementHierarchy_Financial)
                {
                    // Sadly we have to cater for existing applications that never had this page as part of an Blind Assessor check
                    if (await ShouldGetManagementHierarchFinancialPage(applicationId))
                    {
                        page = await GetManagementHierarchFinancialPage(applicationId);
                    }
                }
                else
                {
                    var qnaSection = await _qnaApiClient.GetSectionBySectionNo(applicationId, sequenceNumber, sectionNumber);

                    var qnaPage = qnaSection?.QnAData.Pages.FirstOrDefault(p => p.PageId == pageId || string.IsNullOrEmpty(pageId));

                    if (qnaPage != null)
                    {
                        page = qnaPage.ToAssessorPage(_assessorLookupService, applicationId, sequenceNumber, sectionNumber);

                        var nextPageAction = await _qnaApiClient.SkipPageBySectionNo(page.ApplicationId, page.SequenceNumber, page.SectionNumber, page.PageId);

                        if (nextPageAction != null && NextAction.NextPage.Equals(nextPageAction.NextAction, StringComparison.InvariantCultureIgnoreCase))
                        {
                            page.NextPageId = nextPageAction.NextActionId;
                        }
                        else if (page.PageId == RoatpWorkflowPageIds.DeliveringApprenticeshipTraining.ManagementHierarchy)
                        {
                            // Sadly we have to cater for existing applications that never had this page as part of an Blind Assessor check
                            if (await ShouldGetManagementHierarchFinancialPage(applicationId))
                            {
                                // Move to injected page which shows Financial information to Assessor/Moderator
                                page.NextPageId = RoatpWorkflowPageIds.DeliveringApprenticeshipTraining.ManagementHierarchy_Financial;
                            }
                        }
                    }
                }
            }

            return(page);
        }