/// <summary>
        /// Creates an instance of CustomerProducts from a base64 encoded BSON string
        /// </summary>
        /// <param name="bson">The base64 encoded BSON string</param>
        /// <returns>A CustomerProducts object instance</returns>
        public static CustomerProducts FromBson(string bson)
        {
            List <DataLayer.CustomerProduct.SerializableCustomerProduct> zc;

            byte[]           data = Convert.FromBase64String(bson);
            CustomerProducts tmp  = new CustomerProducts();

            using (System.IO.MemoryStream ms = new System.IO.MemoryStream(data))
            {
                using (Newtonsoft.Json.Bson.BsonReader reader = new Newtonsoft.Json.Bson.BsonReader(ms))
                {
                    reader.ReadRootValueAsArray = true;
                    Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer();
                    zc = serializer.Deserialize <List <DataLayer.CustomerProduct.SerializableCustomerProduct> >(reader);
                }
            }

            foreach (DataLayer.CustomerProduct.SerializableCustomerProduct z in zc)
            {
                tmp.Add(CustomerProduct.FromJson(Newtonsoft.Json.JsonConvert.SerializeObject(z)));
            }

            if (zc.Count > 0)
            {
                Encryption64 decryptor = new Encryption64();
                tmp._connectionString = decryptor.Decrypt(zc[0].SerializationConnectionString, DataLayer.Universal.LayerGenEncryptionKey);
            }

            return(tmp);
        }
        /// <summary>
        /// Creates an instance of CustomerProducts from a JSON string
        /// </summary>
        /// <param name="json">The JSON string</param>
        /// <returns>A CustomerProducts object instance</returns>
        public static CustomerProducts FromJson(string json)
        {
            List <DataLayer.CustomerProduct.SerializableCustomerProduct> zs = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DataLayer.CustomerProduct.SerializableCustomerProduct> >(json);
            CustomerProducts tmp = new CustomerProducts();

            foreach (DataLayer.CustomerProduct.SerializableCustomerProduct z in zs)
            {
                tmp.Add(CustomerProduct.FromJson(Newtonsoft.Json.JsonConvert.SerializeObject(z)));
            }

            if (zs.Count > 0)
            {
                Encryption64 decryptor = new Encryption64();
                tmp._connectionString = decryptor.Decrypt(zs[0].SerializationConnectionString, DataLayer.Universal.LayerGenEncryptionKey);
            }

            return(tmp);
        }
        /// <summary>
        /// Creates an instance of CustomerProducts from an XML string
        /// </summary>
        /// <param name="xml">The XML string</param>
        /// <returns>A CustomerProducts object instance</returns>
        public static CustomerProducts FromXml(string xml)
        {
            System.Xml.Serialization.XmlSerializer xType = new System.Xml.Serialization.XmlSerializer(typeof(List <DataLayer.CustomerProduct.SerializableCustomerProduct>));
            List <DataLayer.CustomerProduct.SerializableCustomerProduct> zc;
            CustomerProducts tmp = new CustomerProducts();

            using (System.IO.StringReader sr = new System.IO.StringReader(xml))
            {
                zc = (List <DataLayer.CustomerProduct.SerializableCustomerProduct>)xType.Deserialize(sr);
            }

            foreach (DataLayer.CustomerProduct.SerializableCustomerProduct z in zc)
            {
                tmp.Add(CustomerProduct.FromJson(Newtonsoft.Json.JsonConvert.SerializeObject(z)));
            }

            if (zc.Count > 0)
            {
                Encryption64 decryptor = new Encryption64();
                tmp._connectionString = decryptor.Decrypt(zc[0].SerializationConnectionString, DataLayer.Universal.LayerGenEncryptionKey);
            }

            return(tmp);
        }