public function getTemplateById($templateId)
{
$templateRecord = FormBuilder2_TemplateRecord::model()->findById($templateId);
if ($templateRecord) {
return FormBuilder2_TemplateModel::populateModel($templateRecord);
} else {
throw new Exception(404, Craft::t('No template exists with the ID “{id}”', array('id' => $template->id)));
}
}