private String formatCreditPoints(final Level level) {
   if (level.getMinCreditPoints() < 0 || level.getMaxCreditPoints() < 0) {
     return "";
   }
   return "min-cp=\""
       + level.getMinCreditPoints()
       + "\" "
       + "max-cp=\""
       + level.getMaxCreditPoints()
       + "\"";
 }
  private void traverse(final Level level, final Integer depth, final StringBuilder sb) {
    final int newDepth = depth + 1;
    final String indent = Strings.repeat(INDENTATION, depth);
    sb.append(indent)
        .append("<l name=\"")
        .append(level.getName())
        .append("\" ")
        .append(formatCreditPoints(level))
        .append(" ")
        .append(formatRequirements(level))
        .append(">\n");

    if (level.getChildren() != null && !level.getChildren().isEmpty()) {
      level.getChildren().forEach(l -> traverse(l, newDepth, sb));
    } else {
      level.getModules().forEach(m -> traverse(m, newDepth, sb));
    }

    sb.append("\n").append(indent).append("</l>\n");
  }
 private String formatRequirements(final Level level) {
   if (level.getMin() < 0 || level.getMax() < 0) {
     return "";
   }
   return "min=\"" + level.getMin() + "\" max=\"" + level.getMax() + "\"";
 }