public function createSubjectAction(Category $category)
    {
        $forum = $category->getForum();
        $collection = new ResourceCollection(array($forum->getResourceNode()));

        if (!$this->authorization->isGranted('post', $collection)) {
            throw new AccessDeniedException($collection->getErrorsForDisplay());
        }

        $form = $this->get('form.factory')->create(new SubjectType(), new Subject);
        $form->handleRequest($this->get('request'));

        if ($form->isValid()) {
            $user = $this->tokenStorage->getToken()->getUser();
            $subject = $form->getData();
            $subject->setCreator($user);
            $subject->setAuthor($user->getFirstName() . ' ' . $user->getLastName());
            //instantiation of the new resources
            $subject->setCategory($category);
            $this->manager->createSubject($subject);
            $dataMessage = $form->get('message')->getData();

            if ($dataMessage['content'] !== null) {
                $message = new Message();
                $message->setContent($dataMessage['content']);
                $message->setCreator($user);
                $message->setAuthor($user->getFirstName() . ' ' . $user->getLastName());
                $message->setSubject($subject);
                $this->manager->createMessage($message, $subject);

                return new RedirectResponse(
                    $this->generateUrl('claro_forum_subjects', array('category' => $category->getId()))
                );
            }
        }

        $form->get('message')->addError(
            new FormError($this->get('translator')->trans('field_content_required', array(), 'forum'))
        );

        return array(
            'form' => $form->createView(),
            '_resource' => $forum,
            'workspace' => $forum->getResourceNode()->getWorkspace()
        );
    }