/// <summary>
        /// Updates the serializer.
        /// </summary>
        public static void UpdateSerializer()
        {
            if ( serializer.HasCache("ScriptingApplication") )
            {
                serializer.RemoveSerializerCache("ScriptingApplication");
                serializer = new XmlTypeSerializer();

                // update
                // Initiate serializer.
                ScriptingApplicationSerializer init = new ScriptingApplicationSerializer();
            }
        }
        /// <summary>
        /// Returns a clone of the object.
        /// </summary>
        /// <param name="sessionScripting"> The session scripting.</param>
        /// <returns> A clone of the object.</returns>
        public static object Clone(ScriptingApplication sessionScripting)
        {
            if ( serializer == null )
            {
                // Initiate serializer.
                ScriptingApplicationSerializer init = new ScriptingApplicationSerializer();
            }

            XmlNode node = serializer.WriteXmlNode(typeof(ScriptingApplication), sessionScripting, "ScriptingApplication");
            XmlNode clone = node.Clone();
            return serializer.ReadXmlNode(typeof(ScriptingApplication), clone, "ScriptingApplication");
        }
 /// <summary>
 /// Returns a ScriptingApplication.
 /// </summary>
 /// <param name="xml"> The xml to load.</param>
 /// <returns> A ScriptingApplication type.</returns>
 public static ScriptingApplication FromXml(string xml)
 {
     ScriptingApplicationSerializer serializer = new ScriptingApplicationSerializer();
     return (ScriptingApplication)serializer.Create(xml);
 }
        /// <summary>
        /// Decrypts a XmlDocument representing a scripting application.
        /// </summary>
        /// <param name="encryptedDocument"> A XmlDocument type.</param>
        /// <returns> A decrypted Scripting Application.</returns>
        public static ScriptingApplication Decrypt(XmlDocument encryptedDocument)
        {
            // add to new document
            XmlNode node = encryptedDocument.SelectSingleNode("//EncryptedData");
            ScriptingApplication scrapp = null;
            ScriptingApplicationSerializer serializer = new ScriptingApplicationSerializer();

            if ( node != null )
            {
                XmlDocument document = new XmlDocument();
                document.AppendChild(document.ImportNode(node,true));

                // decrypt
                EncryptXml decrypt = new EncryptXml(document);
                decrypt.AddKeyNameMapping("scriptingApplication", decrypt.GetMachineStoreKey("Ecyware.ScrAppEncryption"));
                decrypt.DecryptDocument();

                scrapp = (ScriptingApplication)serializer.Create(document.DocumentElement.OuterXml);
            }
            else
            {
                scrapp = (ScriptingApplication)serializer.Create(encryptedDocument.DocumentElement.OuterXml);
            }

            return scrapp;
        }