public function publishUnpublish($id,
        User $userEntity
    )
    {
        if ($id === null) {
            throw new ItemNotSelectedException;
        }
        $entity = $this->getById($id);
        $entity->published = !$entity->published;
        $entity->modifiedOn = new DateTime();
        $entity->modifiedBy = $userEntity;
        $this->repository->saveItem($entity);
    }