Using UButton::SetStyle(OtherStyle) updates detail panel but doesn't serialize

Hey,

Bit if back story to this one.

I have a detail customization. An action of this is the set the style of the selected Widget in a WidgetBlueprint.
eg. User selects a button they have in the graph

When I use TargetButton->SetStyle(SelectedStyle); followed by TargetButton->SynchronizeProperties();

the detail panel is updated, also the Widget in the graph/designer is updated.

However it doesn’t mark it as Dirty and therefore doesn’t save. Am I doing this completely wrong? Is there a way to make sure when UButton::WidgetStyle is set, that it is saved as part of the reflection system?
I have tried manually marking it as dirty and also tried calling ::Modify() //which returned false;

Thanks

My bad here. I was using a transient reference. I directly modified the asset using the Asset Registry and it worked.
Big thanks to Eduard Gelbling.