@Override
  protected SectionBreadcrumb findNextBreadcrumb(
      final QuestionnaireDefinition questionnaireDefinition,
      final Questionnaire questionnaire,
      Map<String, Object> answers,
      final SectionBreadcrumb lastBreadcrumb,
      final Integer lastBreadcrumbPosition) {

    SectionBreadcrumb breadcrumb =
        (SectionBreadcrumb)
            breadcrumbService.findByQuestionnaireIdAndPosition(
                questionnaire.getId(), lastBreadcrumbPosition + 1);

    SectionBreadcrumb nextBreadcrumb = null;

    // There is no real section when QuestionsRandomization is enabled
    if (breadcrumb == null
        && !questionnaireDefinition
            .getRandomizationStrategy()
            .equals(RandomizationStrategy.QUESTIONS_RANDOMIZATION)) {
      Assert.isInstanceOf(SectionBreadcrumb.class, lastBreadcrumb);

      Integer position =
          sectionService.positionInQuestionnaireDefinition(lastBreadcrumb.getSection().getId());
      Section next =
          sectionService.findOneByPositionInQuestionnaireDefinition(
              questionnaireDefinition.getId(), position + 1);
      // The respondent has reached the last question group
      if (next == null) {
        return null;
      }
      nextBreadcrumb =
          SectionBreadcrumb.with()
              .questionnaire(questionnaire)
              .section(next)
              .renderingMode(RenderingMode.SECTION_BY_SECTION)
              .build();
      Integer lastQuestionNumberDisplayed = extractLastQuestionNumberDisplayed(lastBreadcrumb);
      populateQuestionsBreadcrumbs(Arrays.asList(nextBreadcrumb), lastQuestionNumberDisplayed + 1);
    } else {
      nextBreadcrumb = breadcrumb;
    }
    return nextBreadcrumb;
  }
  @Override
  protected PageStructure createPageStructure(
      RandomizationStrategy randomizationStrategy,
      List<SectionBreadcrumb> breadcrumbs,
      Map<String, Object> answers) {
    PageStructure nextPage = super.createPageStructure(randomizationStrategy, breadcrumbs, answers);
    Breadcrumb active = breadcrumbs.get(0);

    SectionBreadcrumb sectionBreadcrumb = (SectionBreadcrumb) active;
    Builder builder = Section.with();
    if (!randomizationStrategy.equals(RandomizationStrategy.QUESTIONS_RANDOMIZATION)) {
      builder.id(sectionBreadcrumb.getSection().getId());
    }
    Section section = builder.build();
    for (QuestionBreadcrumb questionBreadcrumb : sectionBreadcrumb.getBreadcrumbs()) {
      section.addQuestion(
          Question.with()
              .id(questionBreadcrumb.getQuestion().getId())
              .number(questionBreadcrumb.getQuestionNumber())
              .build());
    }
    nextPage.addSection(section);
    return nextPage;
  }