public static ServiceProviderItem Unwrap(SoapServiceProviderItem sobj)
        {
            Type type = Type.GetType(sobj.TypeName);
            ServiceProviderItem item = (ServiceProviderItem)Activator.CreateInstance(type);

            // get properties
            if (sobj.Properties != null)
            {
                // get type properties and add it to the hash
                Dictionary <string, PropertyInfo> hash = new Dictionary <string, PropertyInfo>();
                PropertyInfo[] propInfos = GetTypeProperties(type);

                foreach (PropertyInfo propInfo in propInfos)
                {
                    hash.Add(propInfo.Name, propInfo);
                }

                // set service item properties
                foreach (string pair in sobj.Properties)
                {
                    int    idx  = pair.IndexOf('=');
                    string name = pair.Substring(0, idx);
                    string val  = pair.Substring(idx + 1);
                    if (hash.ContainsKey(name))
                    {
                        // set value
                        PropertyInfo propInfo = hash[name];
                        propInfo.SetValue(item, Cast(val, propInfo.PropertyType), null);
                    }
                }
            }

            return(item);
        }
        // static methods
        public static SoapServiceProviderItem Wrap(ServiceProviderItem item)
        {
            if (item == null)
            {
                return(null);
            }

            // wrap only "persistent" properties
            SoapServiceProviderItem sobj = new SoapServiceProviderItem();

            sobj.TypeName = item.GetType().AssemblyQualifiedName;

            // add common properties
            Hashtable props = GetObjectProperties(item, true);

            props.Add("Id", item.Id.ToString());
            props.Add("Name", item.Name);
            props.Add("ServiceId", item.ServiceId.ToString());
            props.Add("PackageId", item.PackageId.ToString());

            List <string> wrProps = new List <string>();

            foreach (string key in props.Keys)
            {
                wrProps.Add(key + "=" + props[key].ToString());
            }

            sobj.Properties = wrProps.ToArray();
            return(sobj);
        }