Fix template routing

Template router name creation reworked
Attachment model consistency fix