protected function checkTree(SwatTreeFlydownNode $tree, $level = 0)
    {
        if ($level > 2) {
            throw new SwatException(
                'SwatGroupedFlydown tree must not be ' .
                    'more than 3 levels including the root node.'
            );
        }

        foreach ($tree->getChildren() as $child) {
            $this->checkTree($child, $level + 1);
        }
    }