public function editAction(Request $request, $id = null)
	{
		if ( false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') )
			throw new AccessDeniedException();
		  
		$formFactory = $this->get('asf_website.form.factory.config');
		$configManager = $this->get('asf_website.config.manager');
		  
		if ( !is_null($id) ) {
			$config = $configManager->getRepository()->findOneBy(array('id' => $id));
			$success_message = $this->get('translator')->trans('Updated successfully', array(), 'asf_website');
				
		} else {
			$config = $configManager->createInstance();
			$config->setName($this->get('translator')->trans('New website config', array(), 'asf_website'));
			$success_message = $this->get('translator')->trans('Created successfully', array(), 'asf_website');
		}
	
		if ( is_null($config) )
			throw new \Exception($this->get('translator')->trans('An error occurs when generating or getting the configuration', array(), 'asf_website'));

		$form = $formFactory->createForm();
		$form->setData($config);
		
		$formHandler = new ConfigFormHandler($form, $request, $this->container);
		
		if ( true === $formHandler->process() ) {
			try {
				if ( is_null($config->getId()) ) {
					$configManager->getEntityManager()->persist($config);
				}
				$configManager->getEntityManager()->flush();
				 
				$this->get('asf_layout.flash_message')->success($success_message);

				return $this->redirect($this->get('router')->generate('asf_website_config_edit', array('id' => $config->getId())));

			} catch(\Exception $e) {
				$this->get('asf_layout.flash_message')->danger($e->getMessage());
			}
		}

		return $this->render('ASFWebsiteBundle:Config:edit.html.twig', array(
			'config' => $config,
			'form' => $form->createView()
		));
	}