public static function createChoices(array $choices) {

        // Initialize the output.
        $output = [];

        // Sort the nodes.
        $sorter = new AlphabeticalTreeSort($choices);
        $sorter->sort();

        // Handle each node.
        foreach ($sorter->getNodes() as $current) {

            // Get and check the path.
            $path = static::getPath($current);
            if (false === array_key_exists($path[0]->getAlphabeticalTreeNodeLabel(), $output)) {
                $output[$current->getAlphabeticalTreeNodeLabel()] = [];
            }
            if (1 === count($path)) {
                continue;
            }

            // Add the node.
            $output[$path[0]->getAlphabeticalTreeNodeLabel()][] = $current;
        }

        // Return the output.
        return $output;
    }