generize mustache template model function