public static bool SaveTemplate(string name, string description, ModuleInstanceContext context,
                                        bool forceOverwrite, int maxNumberOfRecords)
        {
            var doc = new XmlDocument();
            var moduleInfo = new ModuleController().GetModule(context.Configuration.ModuleID, context.Configuration.TabID);
            var node = ModuleSerializationController.SerializeModule(doc, moduleInfo, true, maxNumberOfRecords);
            // add PaneName as element "name"
            var paneNode = doc.CreateElement("name");
            paneNode.InnerXml = context.Configuration.PaneName;
            node.AppendChild(paneNode);
            var template = new TemplateInfo
                               {
                                   Name = name,
                                   Description = description,
                                   ExportContent = XslTemplatingUtilities.PrettyPrint(node.OuterXml)
                               };

            var fileName = string.Format("{0}.{1}.module.template", Globals.CleanFileName(name),
                                         moduleInfo.DesktopModule.ModuleName.ToLowerInvariant());

            var portalSettings = context.PortalSettings;
            var folder = Utilities.GetFolder(portalSettings, Definition.TemplateFolderName);

            if (Utilities.SaveScript( template.GetXml(), fileName, folder, forceOverwrite))
            {
                ClearCache();
                return true;
            }
            return false;
        }