public function setProperty($propertyName, $value): void
    {
        $this->materializeNodeDataAsNeeded();
        // Arrays could potentially contain entities and objects could be entities. In that case even if the object is the same it needs to be persisted in NodeData.
        if (!is_object($value) && !is_array($value) && $this->getProperty($propertyName) === $value) {
            return;
        }
        $oldValue = $this->hasProperty($propertyName) ? $this->getProperty($propertyName) : null;
        $this->emitBeforeNodePropertyChange($this, $propertyName, $oldValue, $value);
        $this->nodeData->setProperty($propertyName, $value);

        $this->context->getFirstLevelNodeCache()->flush();
        $this->emitNodePropertyChanged($this, $propertyName, $oldValue, $value);
        $this->emitNodeUpdated($this);
    }