public void UpdatePropetyLatLong(List <PropertyModel> PropertiesList)
 {
     try
     {
         PropertiesLatLongs model = new PropertiesLatLongs();
         var MlsIds     = _GenrateLatLongFromAddressServices.GetPropertiesLatLongs().Select(c => c.MLSID).ToList();
         var Properties = PropertiesList.Where(c => !MlsIds.Contains(c.MLS));
         int CheckCount = 1;
         foreach (var property in Properties)
         {
             if (property.Address != null && property.Address != "")
             {
                 if (CheckCount < 2500)
                 {
                     property.Address += "," + property.Community + "," + property.Municipality;
                     var latlong = GoogleOperation.GetLongitudeAndLatitude(property.Address, "false");
                     if (latlong != "")
                     {
                         var splitstr = latlong.Split(',');
                         model.longitude = Convert.ToDecimal(splitstr[0]);
                         model.latitude  = Convert.ToDecimal(splitstr[1]);
                         model.MLSID     = property.MLS;
                         model.Address   = property.Address;
                         _GenrateLatLongFromAddressServices.InsertPropertiesLatLongs(model);
                     }
                     CheckCount = CheckCount + 1;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public PropertiesLatLongs InsertPropertiesLatLongs(PropertiesLatLongs model)
 {
     try
     {
         using (IDbConnection _db = OpenConnection())
         {
             string             query             = "insert into PropertiesLatLong values(@MLSID,@Address,@latitude,@longitude)";
             PropertiesLatLongs PropertiesLatLong = _db.Query <PropertiesLatLongs>(query, new { Address = model.Address, MLSID = model.MLSID, latitude = model.latitude, longitude = model.longitude }).FirstOrDefault();
             return(PropertiesLatLong);
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }