@Override
 protected SectionBreadcrumb findPreviousBreadcrumb(
     final QuestionnaireDefinition questionnaireDefinition,
     final Questionnaire questionnaire,
     final SectionBreadcrumb lastBreadcrumb,
     final Integer lastBreadcrumbPosition) {
   if (lastBreadcrumbPosition == INITIAL_POSITION) {
     return null;
   }
   Breadcrumb breadcrumb =
       breadcrumbService.findByQuestionnaireIdAndPosition(
           questionnaire.getId(), lastBreadcrumbPosition - 1);
   Assert.isInstanceOf(SectionBreadcrumb.class, breadcrumb);
   return (SectionBreadcrumb) breadcrumb;
 }
  @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;
  }