protected function validateItem (MenuItem $item)
    {
        // MenuItem has children.
        if (count($item->getChildren()) > 0) {
            foreach ($item->getChildren() as $childItem) {
                if (! $this->validateItem($childItem)) {
                    return false;
                }
            }

            // If there are children, the title cannot be longer than 16 characters.
            if (strlen($item->getTitle()) > 16) {
                return false;
            }
            
            return true;
        }

        // Title cannot be longer than 40 characters.
        if (strlen($item->getTitle()) > 40) {
            return false;
        }

        // URLs cannot be longer than 256 characters.
        if ($item->getType() == MenuItem::URL && strlen($item->getKey()) > 256) {
            return false;
        } elseif (strlen($item->getKey()) > 128) {
            return false;
        } elseif (strlen($item->getKey()) < 1) {
            return false;
        }

        return true;
    }