public function publish(NodeTranslation $nodeTranslation, $user = null)
    {
        if (false === $this->authorizationChecker->isGranted(PermissionMap::PERMISSION_PUBLISH, $nodeTranslation->getNode())) {
            throw new AccessDeniedException();
        }

        if (is_null($user)) {
            $user = $this->tokenStorage->getToken()->getUser();
        }

        $node = $nodeTranslation->getNode();

        $nodeVersion = $nodeTranslation->getNodeVersion('draft');
        if (!is_null($nodeVersion)) {
            $page = $nodeVersion->getRef($this->em);
            /** @var $nodeVersion NodeVersion */
            $nodeVersion = $this->createPublicVersion($page, $nodeTranslation, $nodeVersion, $user);
            $nodeTranslation = $nodeVersion->getNodeTranslation();
        } else {
            $nodeVersion = $nodeTranslation->getPublicNodeVersion();
        }

        $page = $nodeVersion->getRef($this->em);

        $this->eventDispatcher->dispatch(
            Events::PRE_PUBLISH,
            new NodeEvent($node, $nodeTranslation, $nodeVersion, $page)
        );
        $nodeTranslation
            ->setOnline(true)
            ->setPublicNodeVersion($nodeVersion)
            ->setUpdated(new \DateTime());
        $this->em->persist($nodeTranslation);
        $this->em->flush();

        // Remove scheduled task
        $this->unSchedulePublish($nodeTranslation);

        $this->eventDispatcher->dispatch(
            Events::POST_PUBLISH,
            new NodeEvent($node, $nodeTranslation, $nodeVersion, $page)
        );
    }