public function addMenuItem($options)
    {
        foreach (['alias', 'name', 'priority'] as $attr) {
            if (!isset($options[$attr]) || (isset($options[$attr]) && $options[$attr] === '')) {
                throw new Exception('$options[\'' . $attr . '\'] is missing.');
            }
        }

        $menuItem = [
            'alias' => $options['alias'],
            'name' => $options['name'],
            'priority' => $options['priority'],
            'matchAction' => $options['matchAction'] ?? false,
            'doNotMatchAction' => [],
            'linkOptions' => $options['linkOptions'] ?? []
        ];

        if (isset($options['name_short'])) {
            $menuItem['name_short'] = $options['name_short'];
        }

        if (isset($options['icon'])) {
            $menuItem['icon'] = $options['icon'];
        }

        if (isset($options['url']) && is_array($options['url']) && !empty($options['url'])) {
            $url = $options['url'];
            if (!isset($url['plugin']) || (isset($url['plugin']) && $url['plugin'] === '')) {
                $url['plugin'] = null;
            }
            if (!isset($url['controller'])) {
                throw new Exception('$options[\'url\'][\'controller\'] is missing.');
            }
            if (!isset($url['action'])) {
                throw new Exception('$options[\'url\'][\'action\'] is missing.');
            }
            $menuItem['url'] = $url;
        }

        if (isset($options['doNotMatchAction'])) {
            $menuItem['doNotMatchAction'] = is_array($options['doNotMatchAction']) ? $options['doNotMatchAction'] : [$options['doNotMatchAction']];
        }

        if (isset($options['parent'])) {
            if (!isset($this->_menuItems[$options['parent']])) {
                throw new Exception('No menu item with the alias specified in $options[\'parent\'] "' . $options['parent'] . '"exists.');
            }
            $menuItem['parent'] = $options['parent'];
            $this->_menuItems[$menuItem['parent']]['children'][$menuItem['alias']] = $menuItem;
        } else {
            $this->_menuItems[$menuItem['alias']] = $menuItem;
        }

        return $this;
    }