class PostmanService {

    List<NewmanScenario> toScenarios(Item[] items, AtomicInteger requestPosition, String parentSeverity, String... parentFolders) {
        List<NewmanScenario> newmanScenarios = new ArrayList<>();
        if (items != null) {
            for (Item item : items) {
                // Compute item severity (deepest items' severity override severity of previous ones)
                String severity = getSeverity(ArrayUtils.addAll(parentFolders, item.getName()));
                if (StringUtils.isEmpty(severity)) {
                    severity = parentSeverity;
                }

                // Compute item path (without any tag)
                String nameWithoutTag = removeSeverityTag(item.getName());
                String[] path = ArrayUtils.addAll(parentFolders, nameWithoutTag);

                ExecutedScenario executedScenario = new ExecutedScenario(); // UNIQUE: "runId", "featureFile", "name", "line"
                executedScenario.setName(String.join(FOLDER_DELIMITER, path));
                executedScenario.setLine(requestPosition.incrementAndGet());
                executedScenario.setCucumberId(toCucumberId(path));
                executedScenario.setSeverity(severity);
                executedScenario.setTags(StringUtils.isEmpty(severity) ? null : Tag.SEVERITY_PREFIX + severity);

                NewmanScenario newmanScenario = new NewmanScenario();
                newmanScenario.setScenario(executedScenario);
                newmanScenario.setItem(item);
                newmanScenarios.add(newmanScenario);

                newmanScenarios.addAll(toScenarios(item.getChildren(), requestPosition, severity, path));
            }
        }
        return newmanScenarios;
    }

}