private function handlePublish(ConnectionInterface $from, $msg, $data) {
    if (isset($data['guid'])
        && (
          $data['event'] === 'delete'
          || (
            isset($data['entity'])
            && ($data['event'] === 'create' || $data['event'] === 'update')
          )
        )
      ) {
      // Publish is an entity.

      // Relay the publish to other servers.
      $this->relay($msg);

      $this->handlePublishEntity($from, $data);
    }

    if ((
          isset($data['name'])
          || (isset($data['oldName']) && isset($data['newName']))
        )
        && in_array(
            $data['event'],
            ['newUID', 'setUID', 'renameUID', 'deleteUID']
        )
      ) {
      // Publish is a UID.

      // Relay the publish to other servers.
      $this->relay($msg);

      $this->handlePublishUid($from, $data);
    }
  }