class LandingModelPopulator implements CompetitionSetupSectionModelPopulator {

    @Override
    public CompetitionSetupViewModel populateModel(GeneralSetupViewModel generalViewModel, CompetitionResource competitionResource) {
        List<SectionResource> sections = sectionService.getAllByCompetitionId(competitionResource.getId());
        List<QuestionResource> questionResources = questionRestService.findByCompetition(competitionResource.getId()).getSuccess();
        List<SectionResource> generalSections = sections.stream()
                .filter(sectionResource -> sectionResource.getType() == SectionType.GENERAL)
                .collect(Collectors.toList());
        List<SectionResource> parentSections = generalSections.stream()
                .filter(sectionResource -> sectionResource.getParentSection() == null)
                .collect(Collectors.toList());

        Map<CompetitionSetupSubsection, Boolean> subSectionsStatuses = convertWithDefaultsIfNotPresent(competitionSetupRestService.getSubsectionStatuses(competitionResource.getId()).getSuccess());
        Map<Long, Boolean> questionStatuses = questionSetupRestService.getQuestionStatuses(competitionResource.getId(), sectionToPopulateModel()).getSuccess();

        List<QuestionResource> questions = getSortedQuestions(questionResources, parentSections);
        List<QuestionResource> projectDetails = getSortedProjectDetails(questionResources, parentSections);

        Boolean allStatusesComplete = checkStatusesComplete(subSectionsStatuses, questionStatuses, questions, projectDetails);

        return new LandingViewModel(generalViewModel,
                questions,
                projectDetails,
                subSectionsStatuses,
                questionStatuses,
                allStatusesComplete);
    }

}