public function setNodeSegment(NodeInterface $node, string $segment, ?string $previous = null) : void
    {
        if ($this->isNodeBlacklisted($node)) {
            return;
        }

        if (!$previous) {
            $previous = $this->getNodeSegment($node);
        }
        if (empty($segment)) {
            $segment = null;
        }

        if ($previous === $segment) {
            return; // Nothing to do
        }

        $this
            ->database
            ->merge('ucms_seo_node')
            ->key(['nid' => $node->id()])
            ->fields(['alias_segment' => $segment])
            ->execute()
        ;

        if (empty($segment)) {
            $this->onAliasChange([$node->id()]);
        } else {
            $this->onAliasChange([$node->id()]);
        }
    }