public function setTimestampsOnNode(
        LocalizedTimestampBehavior $document,
        NodeInterface $node,
        DocumentAccessor $accessor,
        $locale,
        $timestamp = null
    ) {
        if (!$document instanceof TimestampBehavior && !$locale) {
            return;
        }

        $encoding = $this->getPropertyEncoding($document);

        $createdPropertyName = $this->propertyEncoder->encode($encoding, static::CREATED, $locale);
        if (!$node->hasProperty($createdPropertyName)) {
            $createdTimestamp = $document->getCreated() ?: $timestamp;
            $accessor->set(static::CREATED, $createdTimestamp);
            $node->setProperty($createdPropertyName, $createdTimestamp);
        }

        $changedTimestamp = $timestamp ?: $document->getChanged();
        $accessor->set(static::CHANGED, $changedTimestamp);
        $node->setProperty($this->propertyEncoder->encode($encoding, static::CHANGED, $locale), $changedTimestamp);
    }