validate templates on save; separate out preview controller functions