Correct way of setting and copying properties

We have a case when we need to change the styling of an element based on a custom attribute.

So to achieve it we introduced new events and updated properties once it’s triggered.

eventBus.on( 'connect.any-object', ({ element }: { element: Element }) => {
     modeling.updateProperties(element, { connectedObjectId: 'any-object-id', connectedObjectTitle: "title"});
});

This works fine until you decide to copy past the element.
The pasted element does not have the properties so the styling is ignored.

The question is how to properly handle such kind of cases, and if this is proper way of doing it, how can I make sure that the custom properties are copied?

Thanks in advance!

Solution is here.