public function newAction(Request $request)
    {
        $category = new Category();
        $form = $this->createForm('BlogBundle\Form\CategoryType', $category);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($category);
            $em->flush();

            $this->get('session')->getFlashBag()->add('success', 'category.created');
            
            return $this->redirectToRoute('blog_category_index');
        }

        return array(
            'category' => $category,
            'form' => $form->createView(),
        );
    }