public function addPlugin($pluginDetails, $details = '', $installedWith = 'packagist')
 {
     $em = $this->getEntityManager();
     $plugin = $em->getRepository('Newscoop\\Entity\\Plugin')->findOneByName($pluginDetails['name']);
     if (!$plugin) {
         $authors = array();
         foreach ($pluginDetails['authors'] as $key => $value) {
             $authors[] = $value['name'] . '<' . $value['email'] . '>';
         }
         $plugin = new Plugin();
         $plugin->setName($pluginDetails['name']);
         $plugin->setVersion($pluginDetails['version']);
         $plugin->setDetails($details);
         $plugin->setDescription($pluginDetails['description']);
         $plugin->setAuthor(implode(',', $authors));
         $plugin->setLicense(implode(',', $pluginDetails['license']));
         $plugin->setType('thirdparty');
         $plugin->setInstalledWith($installedWith);
         $em->persist($plugin);
         $em->flush();
     }
 }
 /**
  * Disable plugin
  * @param  Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     $this->dispatcher->dispatch('plugin.disable', new GenericEvent($this, array('plugin_name' => $plugin->getName(), 'plugin' => $plugin)));
 }