private static WizardModel buildModel(
      final TreatmentCategorizationWizardPresentation pm, final JDialog dialog) {
    final AddTreatmentCategorizationWizardStep generalInfo =
        new AddTreatmentCategorizationWizardStep(pm, dialog);
    final SpecifyDoseTypeWizardStep type = new SpecifyDoseTypeWizardStep(pm, dialog);
    final TreatmentCategorizationOverviewWizardStep overview =
        new TreatmentCategorizationOverviewWizardStep(pm);

    final SimplePath lastPath = new SimplePath(overview);
    final BranchingPath typePath = new BranchingPath(type);
    final BranchingPath firstStep = new BranchingPath(generalInfo);
    final BranchingPath fixedAndFlexiblePath = new BranchingPath(createFixedDose(dialog, pm));

    final ValueModel considerFixed = pm.getConsiderFixed();
    buildFlexiblePath(
        pm, dialog, fixedAndFlexiblePath, type, lastPath, new UnmodifiableHolder<Boolean>(true));
    buildFlexiblePath(pm, dialog, typePath, type, lastPath, new BooleanNotModel(considerFixed));

    final ValueModel anyFlexibleDose =
        new BooleanOrModel(
            Arrays.<ValueModel>asList(
                pm.getConsiderFlexibleLowerFirst(), pm.getConsiderFlexibleUpperFirst()));

    addBranch(
        typePath,
        createSimplePath(lastPath, createFixedDose(dialog, pm)),
        new BooleanAndModel(new BooleanNotModel(anyFlexibleDose), considerFixed));

    addBranch(
        typePath,
        lastPath,
        new BooleanAndModel(
            new BooleanNotModel(anyFlexibleDose), new BooleanNotModel(considerFixed)));

    addBranch(typePath, fixedAndFlexiblePath, new BooleanAndModel(considerFixed, anyFlexibleDose));

    addBranch(
        firstStep,
        lastPath,
        new BooleanNotModel(new BooleanOrModel(pm.getConsiderDoseType(), pm.getIgnoreDoseType())));

    addBranch(firstStep, typePath, pm.getConsiderDoseType());

    addBranch(
        firstStep, createSimplePath(lastPath, createKnownDose(dialog, pm)), pm.getIgnoreDoseType());

    return new DynamicMultiPathModel(firstStep);
  }