Fixes#1658
Add validation in the update_template method to check if a template
with the same name already exists before updating. This prevents
users from creating duplicate template names by editing existing
templates.
The check excludes the current template being edited to allow
updating other properties without changing the name.