/**
  * Action to add a module to the repository
  * @return null
  */
 public function addAction()
 {
     $form = $this->createModuleUploadForm();
     if (!$form->isSubmitted()) {
         $this->response->setRedirect($this->request->getBasePath());
         return;
     }
     $this->response->setRedirect($this->getReferer());
     $exception = null;
     try {
         $form->validate();
         $file = $form->getModule();
         $this->repository->addModule($file);
         $this->addInformation(self::TRANSLATION_MODULE_ADDED, array('file' => $file->getName()));
     } catch (ModuleVersionAlreadyExistsException $e) {
         $parameters = array('namespace' => $e->getNamespace(), 'name' => $e->getName(), 'version' => $e->getVersion());
         $this->addError(self::TRANSLATION_MODULE_EXISTS, $parameters);
     } catch (ValidationException $e) {
         $this->response->setRedirect($this->getReferer());
     } catch (Exception $e) {
         $this->response->clearRedirect();
         $exception = $e;
     }
     if (isset($file) && $file->exists()) {
         $file->delete();
     }
     if ($exception != null) {
         throw $exception;
     }
 }