public function removeUnusedImageVariant(NodeInterface $node, $propertyName, $oldValue, $value)
    {
        if ($oldValue === $value || (!$oldValue instanceof ImageVariant)) {
            return;
        }
        $identifier = $this->persistenceManager->getIdentifierByObject($oldValue);
        $results = $this->nodeDataRepository->findNodesByRelatedEntities([ImageVariant::class => [$identifier]]);

        // This case shouldn't happen as the query will usually find at least the node that triggered this call, still if there is no relation we can remove the ImageVariant.
        if ($results === []) {
            $this->assetRepository->remove($oldValue);
            return;
        }

        // If the result contains exactly the node that got a new ImageVariant assigned then we are safe to remove the asset here.
        if ($results === [$node->getNodeData()]) {
            $this->assetRepository->remove($oldValue);
        }
    }