private static function traverseTree(
        Criterion $node,
        array $children,
        $level
    ) {
        $type = 'n/a';
        $value = 'n/a';

        if ($node->getCaseValue() !== null) {
            $type =
                (new ReflectionClass($node->getCaseValue()))->getShortName();
            if ($node->getCaseValue() instanceof ProductCanonicalCondition) {
                $value = $node->getCaseValue()->getCondition();
            } elseif ($node->getCaseValue() instanceof
                ProductBiddingCategory) {
                $value = sprintf(
                    '%s (%s)',
                    $node->getCaseValue()->getType(),
                    $node->getCaseValue()->getValue()
                );
            } else {
                $value = $node->getCaseValue()->getValue();
            }
        }

        $result = sprintf(
            "%sID: %d, type: %s, value: %s\n",
            str_repeat("  ", $level),
            $node->getId(),
            $type,
            $value
        );
        foreach ($children[$node->getId()] as $childNode) {
            $result .= self::traverseTree($childNode, $children, $level + 1);
        }

        return $result;
    }