public string SaveToXml(VirtualServerEntity entity)
        {
            var serializer = new XmlSerializer(entity.GetType());
            var strb       = new StringBuilder();
            var strw       = new StringWriter(strb, System.Globalization.CultureInfo.InvariantCulture);

            serializer.Serialize(strw, entity);
            string sxml = strb.ToString();

            return(sxml);
        }
        public VirtualServerEntity LoadFromXml(string sxml)
        {
            if (string.IsNullOrEmpty(sxml))
            {
                return(null);
            }

            var entity = new VirtualServerEntity();

            try
            {
                var reader     = new StringReader(sxml);
                var serializer = new XmlSerializer(entity.GetType());
                entity = (VirtualServerEntity)serializer.Deserialize(reader);

                return(entity);
            }
            catch
            {
                return(null);
            }
        }