public static VEHICLE GetVEHICLEFromDocument(Document doc)
        {
            VEHICLE theVal = new VEHICLE();

            theVal._id               = new Oid(doc["_id"].ToString());
            theVal.VIN               = doc["VIN"].ToString();
            theVal.YEAR              = doc["YEAR"].ToString();
            theVal.MAKE              = doc["MAKE"].ToString();
            theVal.MODEL             = doc["MODEL"].ToString();
            theVal.TRIM              = doc["TRIM"].ToString();
            theVal.BODY_STYLE        = doc["BODY_STYLE"].ToString();
            theVal.ENGINE            = doc["ENGINE"].ToString();
            theVal.TRANSMISSION      = doc["TRANSMISSION"].ToString();
            theVal.DRIVE_TRAIN       = doc["DRIVE_TRAIN"].ToString();
            theVal.WHEEL_SIZE        = doc["WHEEL_SIZE"].ToString();
            theVal.COLOR_EXTERIOR    = doc["COLOR_EXTERIOR"].ToString();
            theVal.COLOR_INTERIOR    = doc["COLOR_INTERIOR"].ToString();
            theVal.MARKET            = doc["MARKET"].ToString();
            theVal.IMAGEIDCSV        = (ReferenceEquals(null, doc["IMAGEIDCSV"])) ? "" : doc["IMAGEIDCSV"].ToString();
            theVal.MILEAGE           = doc["MILEAGE"].ToString();
            theVal.CURRENT_PRICE     = doc["CURRENT_PRICE"].ToString();
            theVal.VEHICLE_HISTORY   = doc["VEHICLE_HISTORY"].ToString();
            theVal.STILL_FOR_SALE    = (!ReferenceEquals(null, doc["STILL_FOR_SALE"])) ? doc["STILL_FOR_SALE"].ToString() : "YES";
            theVal.STOCK_NUMBER      = doc["STOCK_NUMBER"].ToString();
            theVal.DEALERSHIP_NAME   = doc["DEALERSHIP_NAME"].ToString();
            theVal.MODEL_CODE        = doc["MODEL_CODE"].ToString();
            theVal.CARFAX_URL        = doc["CARFAX_URL"].ToString();
            theVal.DEALER_DETAIL_URL = doc["DEALER_DETAIL_URL"].ToString();
            theVal.DATE_LAST_SEEN    = DateTime.Parse(doc["DATE_LAST_SEEN"].ToString());

            return(theVal);
        }
        public static VEHICLE[] GetVEHICLEsFromQueryDocument(IMongoCollection <Document> coll, Document query)
        {
            VEHICLE[] arr    = null;
            var       cursor = coll.Find(query);

            if (cursor.Documents.Count() > 0)
            {
                arr = new VEHICLE[cursor.Documents.Count()];

                int ind = 0;
                foreach (Document doc in cursor.Documents)
                {
                    arr[ind++] = GetVEHICLEFromDocument(doc);
                }
            }

            return(arr);
        }
        public static bool UpdateDocumentFromMEMBER(IMongoCollection <Document> coll, VEHICLE val)
        {
            bool     ret = true;
            Document doc = new Document();

            var q = new Document();

            q["_id"] = val._id;
            doc      = coll.FindOne(q);

            if (doc.Count == 0)
            {
                return(false);
            }
            doc["VIN"]               = val.VIN;
            doc["YEAR"]              = val.YEAR;
            doc["MAKE"]              = val.MAKE;
            doc["MODEL"]             = val.MODEL;
            doc["TRIM"]              = val.TRIM;
            doc["BODY_STYLE"]        = val.BODY_STYLE;
            doc["ENGINE"]            = val.ENGINE;
            doc["TRANSMISSION"]      = val.TRANSMISSION;
            doc["DRIVE_TRAIN"]       = val.DRIVE_TRAIN;
            doc["WHEEL_SIZE"]        = val.WHEEL_SIZE;
            doc["COLOR_EXTERIOR"]    = val.COLOR_EXTERIOR;
            doc["COLOR_INTERIOR"]    = val.COLOR_INTERIOR;
            doc["MARKET"]            = val.MARKET;
            doc["IMAGEIDCSV"]        = val.IMAGEIDCSV;
            doc["MILEAGE"]           = val.MILEAGE;
            doc["CURRENT_PRICE"]     = val.CURRENT_PRICE;
            doc["VEHICLE_HISTORY"]   = val.VEHICLE_HISTORY;
            doc["STILL_FOR_SALE"]    = val.STILL_FOR_SALE;
            doc["STOCK_NUMBER"]      = val.STOCK_NUMBER;
            doc["DEALERSHIP_NAME"]   = val.DEALERSHIP_NAME;
            doc["MODEL_CODE"]        = val.MODEL_CODE;
            doc["CARFAX_URL"]        = val.CARFAX_URL;
            doc["DEALER_DETAIL_URL"] = val.DEALER_DETAIL_URL;
            doc["DATE_LAST_SEEN"]    = val.DATE_LAST_SEEN;

            coll.Save(doc);
            return(ret);
        }