public function editAction(Request $request, $id)
    {
        $activityService = $this->get('campaignchain.core.activity');
        $this->activity = $activityService->getActivity($id);
        $this->campaign = $this->activity->getCampaign();
        $this->location = $this->activity->getLocation();

        if($this->parameters['equals_operation']) {
            // Get the one operation.
            $this->operations[0] = $activityService->getOperation($id);
        } else {
            throw new \Exception(
                'Multiple Operations for one Activity not implemented yet.'
            );
        }

        $content = $this->handler->preFormSubmitEditEvent($this->operations[0]);

        $form = $this->createForm(
            ActivityType::class,
            $this->activity,
            $this->getActivityFormTypeOptions('edit')
        );

        $form->handleRequest($request);

        if ($form->isValid()) {

            try {
                $this->activity = $this->editActivity($this->activity, $form, $content);

                $this->addFlash(
                    'success',
                    'Your activity <a href="'.$this->generateUrl('campaignchain_core_activity_edit', array('id' => $this->activity->getId())).'">'.$this->activity->getName().'</a> was edited successfully.'
                );

                return $this->redirect($this->generateUrl('campaignchain_core_activities'));
            } catch(\Exception $e) {
                $this->addFlash(
                    'warning',
                    $e->getMessage()
                );

                $this->getLogger()->error($e->getMessage(), array(
                    'file' => $e->getFile(),
                    'line' => $e->getLine(),
                    'trace' => $e->getTrace(),
                ));
            }
        }

        /*
         * Define default rendering options and then apply those defined by the
         * module's handler if applicable.
         */
        $defaultRenderOptions = array(
            'template' => 'CampaignChainCoreBundle:Operation:new.html.twig',
            'vars' => array(
                'page_title' => 'Edit Activity',
                'activity' => $this->activity,
                'form' => $form->createView(),
                'form_submit_label' => 'Save',
                'form_cancel_route' => 'campaignchain_core_activities'
            )
        );

        $handlerRenderOptions = $this->handler->getEditRenderOptions(
            $this->operations[0]
        );

        return $this->renderWithHandlerOptions($defaultRenderOptions, $handlerRenderOptions);
    }