public function loadPlugins()
    {
        $oldPlugins = $this->getExistingPlugins();
        $pluginBundles = $this->getInstalledPluginBundles($this->kernel);
        $pluginsLoaded = [];

        /**
         * @var Bundle $plugin
         */
        foreach ($pluginBundles as $plugin) {
            $pluginConfiguration = $this
                ->pluginLoader
                ->getPluginConfiguration($plugin->getPath());

            $pluginNamespace = get_class($plugin);
            $pluginInstance = $this
                ->getPluginInstance(
                    $pluginNamespace,
                    $pluginConfiguration
                );

            if (isset($oldPlugins[$pluginNamespace])) {
                $existingPlugin = $oldPlugins[$pluginNamespace];
                $pluginInstance = $existingPlugin->merge($pluginInstance);
                unset($oldPlugins[$pluginNamespace]);
            }

            $this->savePlugin($pluginInstance);

            $pluginsLoaded[] = $pluginInstance;
        }

        /**
         * Every Plugin instance inside $plugins array should be removed from
         * database, because they are not longer installed.
         */
        $this->removePlugins($oldPlugins);

        return $pluginsLoaded;
    }