public function switchPublicationState(Post $post)
    {
        if (!$post->isPublished()) {
            $post->publish();
        } else {
            $post->unpublish();
        }

        $this->om->flush();

        $unitOfWork = $this->om->getUnitOfWork();
        $unitOfWork->computeChangeSets();
        $changeSet = $unitOfWork->getEntityChangeSet($post);

        $this->trackingManager->dispatchPostUpdateEvent($post, $changeSet);

        return $post;
    }