$payload['id'
] =
$existing->
getId();
$existingActionButtons->
remove($existing->
getId());
} $upserts[] =
$payload;
} if (!
empty($upserts)) { $this->actionButtonRepository->
upsert($upserts,
$context);
} $this->
deleteOldActions($existingActionButtons,
$context);
} private function deleteOldActions(ActionButtonCollection
$toBeRemoved, Context
$context): void
{ /** @var array<string> $ids */
$ids =
$toBeRemoved->
getIds();
if (!
empty($ids)) { $ids =
array_map(static fn (string
$id): array =>
['id' =>
$id],
array_values($ids));
$this->actionButtonRepository->
delete($ids,
$context);
}