public static object Deserialize(Stream strm)
        {
            if (strm == null)
            {
                throw new System.ArgumentNullException("strm");
            }

            using (var serializer = SPSerializer.Create())
            {
                var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                return(serializer.Deserialize(formatter, strm));
            }
        }
        public static void Serialize(Stream strm, object obj)
        {
            if (strm == null)
            {
                throw new System.ArgumentNullException("strm");
            }

            if (obj != null)
            {
                using (var serializer = SPSerializer.Create())
                {
                    var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    serializer.Serialize(formatter, strm, obj);
                }
            }
        }