change to a real model instead of map, and templateInstance.model -> templateInstance.model.model