public function addTemplate(Request $request, ParameterBagInterface $bag, $id = null)
    {
        // Find Template
        $mailLog = $this
            ->getDoctrine()
            ->getRepository($this->getParameter('pd_mailer.mail_log_class'))
            ->findOneBy(['id' => $id]);

        // Create New Mail Log
        if (null === $mailLog) {
            $class = $this->getParameter('pd_mailer.mail_log_class');
            $mailLog = new $class;
        }

        // Create Mail Template
        $class = $this->getParameter('pd_mailer.mail_template_class');
        $template = new $class;
        $template->setTemplateId($mailLog->getTemplateId() ?? ' ');
        $template->setSubject($mailLog->getSubject());

        // Create Form
        $form = $this->createForm($this->getParameter('pd_mailer.mail_template_type'), $template, ['parameters' => $bag]);

        // Handle Request
        $form->handleRequest($request);

        // Submit & Valid Form
        if ($form->isSubmitted() && $form->isValid()) {
            // Add object
            $template->setTemplateData($mailLog->getBody());

            // Save
            $em = $this->getDoctrine()->getManager();
            $em->persist($template);
            $em->flush();

            // Message
            $this->addFlash('success', 'changes_saved');

            // Return Edit Page
            $this->redirectToRoute('admin_mail_template_edit', ['id' => $template->getId()]);
        }

        // Render Page
        return $this->render('@PdMailer/template.html.twig', [
            'form' => $form->createView(),
            'objects' => @unserialize($mailLog->getBody()),
            'title' => 'mail_manager_template_add',
            'description' => 'mail_manager_template_add_desc',
            'base_template' => $this->getParameter('pd_mailer.base_template')
        ]);
    }