public HttpResponseMessage SavePageAsTemplate(PageTemplate pageTemplate) { if (!_securityService.CanExportPage(pageTemplate.TabId)) { return(GetForbiddenResponse()); } try { pageTemplate.Clean(); var templateFilename = _templateController.SaveAsTemplate(pageTemplate); var response = string.Format(Localization.GetString("ExportedMessage"), templateFilename); return(Request.CreateResponse(HttpStatusCode.OK, new { Status = 0, Response = response })); } catch (TemplateException ex) { return(Request.CreateResponse(HttpStatusCode.OK, new { Status = 1, ex.Message })); } }