public function createTagAction($label)
{
$existingTag = $this->tagRepository->findOneByLabel($label);
if ($existingTag !== null) {
if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addTag($existingTag)) {
$this->assetCollectionRepository->update($assetCollection);
$this->addFlashMessage('tagAlreadyExistsAndAddedToCollection', '', Message::SEVERITY_OK, [htmlspecialchars($label)]);
}
} else {
$tag = new Tag($label);
$this->tagRepository->add($tag);
if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addTag($tag)) {
$this->assetCollectionRepository->update($assetCollection);
}
$this->addFlashMessage('tagHasBeenCreated', '', Message::SEVERITY_OK, [htmlspecialchars($label)]);
}
$this->redirect('index');
}