public function createAction(Request $request, $siteId = null, $type = 0, $layoutId = null)
    {
        /** @var ContentManager $manager */
        $manager = $this->get('opifer.content.content_manager');

        if ($type) {
            $contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
            $content = $this->get('opifer.eav.eav_manager')->initializeEntity($contentType->getSchema());
            $content->setContentType($contentType);
        } else {
            $content = $manager->initialize();
        }

        if ($siteId) {
            $site = $this->getDoctrine()->getRepository(Site::class)->find($siteId);

            //set siteId on content item
            $content->setSite($site);
            if ($site->getDefaultLocale()) {
                $content->setLocale($site->getDefaultLocale());
            }
        }

        $form = $this->createForm(ContentType::class, $content);
        $form->handleRequest($request);

        if ($form->isValid()) {
            if ($layoutId) {
                $duplicatedContent = $this->duplicateAction($layoutId, $content);

                return $this->redirectToRoute('opifer_content_contenteditor_design', [
                    'owner' => 'content',
                    'ownerId' => $duplicatedContent->getId(),
                ]);
            }

            if (null === $content->getPublishAt()) {
                $content->setPublishAt(new \DateTime());
            }

            $manager->save($content);

            return $this->redirectToRoute('opifer_content_contenteditor_design', [
                'owner' => 'content',
                'ownerId' => $content->getId(),
                'site_id' => $siteId
            ]);
        }

        return $this->render($this->getParameter('opifer_content.content_new_view'), [
            'form' => $form->createView(),
        ]);
    }