class QuestionFormPopulator extends AbstractFormInputQuestionFormPopulator implements CompetitionSetupSubsectionFormPopulator {

    @Override
    public CompetitionSetupForm populateForm(CompetitionResource competitionResource, Optional<Long> objectId) {

        QuestionForm competitionSetupForm = new QuestionForm();

        if (objectId.isPresent()) {
            CompetitionSetupQuestionResource questionResource = questionSetupCompetitionRestService.getByQuestionId(
                    (objectId.get())).getSuccess();
            competitionSetupForm.setQuestion(questionResource);

            if (sectionContainsMoreThanOneQuestion(objectId.get())) {
                competitionSetupForm.setRemovable(true);
            }

            if (questionResource.getNumberOfUploads() == 0) {
                competitionSetupForm.setNumberOfUploads(0);
                questionResource.setAppendix(false);
            } else {
                competitionSetupForm.setNumberOfUploads(questionResource.getNumberOfUploads());
                questionResource.setAppendix(true);
            }

            competitionSetupForm.getQuestion().getGuidanceRows().forEach(guidanceRowResource -> {
                GuidanceRowForm grvm = new GuidanceRowForm(guidanceRowResource);
                competitionSetupForm.getGuidanceRows().add(grvm);
            });

            populateCommon(questionResource, competitionSetupForm);

        } else {
            throw new ObjectNotFoundException();
        }

        return competitionSetupForm;
    }

}