How to reset a component programatically


I’m using the Element Template, and I need to reset all the properties defined to a certain component (UserTask, etc) because I don’t want to keep all the previous modifications I made after I choose a new template.

How to do so, programmatically in a correct way ?

Thank you!