public void GetJobProfileApprenticeshipVacancyReport()
        {
            //Arrange
            SetupCalls();
            var jobProfileReportRepository = new JobProfileReportRepository(fakeJobProfileRepository, fakeJobProfileApprenticeshipVacancyReportConverter, fakeApprenticeVacancyRepository, fakeApprenticeVacancyConverter, fakeDynamicContentExtensions);

            // Act
            jobProfileReportRepository.GetJobProfileApprenticeshipVacancyReport();

            // Assert
            A.CallTo(() => fakeJobProfileRepository.GetMany(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.Status == ContentLifecycleStatus.Master)))).MustHaveHappened();
            A.CallTo(() => fakeApprenticeVacancyRepository.GetMany(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.Status == ContentLifecycleStatus.Master)))).MustHaveHappened();
            A.CallTo(() => fakeDynamicContentExtensions.SetRelatedDataSourceContext(A <IQueryable <DynamicContent> > ._)).MustHaveHappened();
        }
        public IEnumerable <JobProfileApprenticeshipVacancyReport> GetJobProfileApprenticeshipVacancyReport()
        {
            var allJobProfiles = jobProfileRepository.GetMany(x => x.Status == ContentLifecycleStatus.Master);

            dynamicContentExtensions.SetRelatedDataSourceContext(allJobProfiles);

            var allApprenticeVacancies = apprenticeVacancyRepository.GetMany(x => x.Status == ContentLifecycleStatus.Master);

            dynamicContentExtensions.SetRelatedDataSourceContext(allApprenticeVacancies);

            //CodeReview: Why ToList()
            // To avoid Connection reader error, as the process can be long running sitefinity suggest we store list in memory
            // https://knowledgebase.progress.com/articles/Article/invalid-attempt-to-call-isdbnull-when-reader-is-closed-exception
            var apprenticeships = allApprenticeVacancies.Select(a => apprenticeVacancyConverter.ConvertFrom(a)).ToList();
            var profiles        = allJobProfiles.Select(j => jobProfileApprenticeshipVacancyReportConverter.ConvertFrom(j)).ToList();

            profiles.Where(p => p.SocCode != null).ToList().ForEach(p => p.ApprenticeshipVacancies = apprenticeships.Where(av => av.SocCode != null && av.SocCode.Id == p.SocCode.Id));

            return(profiles);
        }