public function uploadAssetAction(Asset $asset, string $metadata, NodeInterface $node, string $propertyName)
    {
        $this->response->setHeader('Content-Type', 'application/json');

        if ($metadata !== 'Asset' && $metadata !== 'Image') {
            $this->response->setStatus(400);
            $result = ['error' => 'Invalid "metadata" type: ' . $metadata];
        } else {
            if ($asset instanceof ImageInterface && $metadata === 'Image') {
                $result = $this->getImageInterfacePreviewData($asset);
            } else {
                $result = $this->getAssetProperties($asset);
            }
            if ($this->persistenceManager->isNewObject($asset)) {
                $this->assetRepository->add($asset);
            }
            $this->emitAssetUploaded($asset, $node, $propertyName);
        }
        return json_encode($result);
    }