public static void WriteListToDatabase(List <Property_Nestoria> list, string garden, string city_id, string country_id, bool buy, string userID, HttpContext context) { List <string> list2 = null; if (context != null) { list2 = (context.Session["idlist"] as List <string>); } if (list2 == null) { list2 = StaticCalls.GetPropertyIDList(); if (context != null) { context.Session.Add("idlist", list2); } } List <string> list3 = list2; List <Property> list4 = new List <Property>(); foreach (Property_Nestoria item in list) { Property property = Nestoria.NestoriaToAkaratak(item, garden, city_id, country_id, userID, buy); property.Property_Photo = StaticCalls.UploadImages(item.img_u, item.thumb_u); if (list3.Contains(item.pr_id)) { StaticCalls.UpdateProperty(property); } else { list4.Add(property); } StaticCalls.send_text("p Added =" + property.Property_Id_ext); } StaticCalls.InsertProperties(list4); }