private function invalidateEntity($entity)
    {
        if ($entity instanceof TaggedEntityInterface) {
            $this->addTagToInvalidate($entity::getEntityTagPrefix());
            if (null !== $entity->getId()) {
                $this->addTagToInvalidate($entity->getEntityTag());
            }
        } elseif ($entity instanceof TranslationInterface) {
            $translatable = $entity->getTranslatable();
            $this->invalidateEntity($translatable);
        }
    }