public function load_plugin_menu($package_name, $menu_data, bool $require_affiliation = false)
    {

        // Validate the package menu
        $this->validate_menu($package_name, $menu_data);

        // Check if the current user has the permission
        // required to see the menu
        if (isset($menu_data['permission'])) {

            // Check if the parameter is an array
            // in such case, we grant access if user has at least one permission
            if (is_array($menu_data['permission'])) {
                foreach ($menu_data['permission'] as $menu_permission)
                    if (auth()->user()->has($menu_permission, $require_affiliation))
                        return $menu_data;

                return null;
            }

            if (! auth()->user()->has($menu_data['permission'], $require_affiliation))
                return null;
        }

        return $menu_data;
    }