public static List <COMimageObject> GetObjectsByCategory(int categoryId)
        {
            List <int>            ids     = new List <int>();
            List <COMimageObject> objects = new List <COMimageObject>();

            //return all objects in all images in specific category
            DALimage.GetImagesByCategoryId(categoryId).ForEach(img => ids.Add(img.ImageID));
            ids.ForEach(id => objects.AddRange(Getobjects().FindAll(obj => obj.ImageID == id)));
            return(objects);
        }
 public static void fix()
 {
     using (var connection = new MySqlConnection(csb.ConnectionString))
     {
         List <COMimageObject> objs = new List <COMimageObject>();
         foreach (COMimage item in DALimage.Getimages().FindAll(img => img.CategoryID == 5))
         {
             objs.AddRange(Getobjects().FindAll(obj => obj.ImageID == item.ImageID));
         }
         connection.Open();
         foreach (COMimageObject item in objs)
         {
             MySqlCommand update_name_and_voiceurl = new MySqlCommand("UPDATE Objects_tbl SET voiceURL=@VoiceURL WHERE objectId=@objId;", connection);
             update_name_and_voiceurl.Parameters.AddWithValue("VoiceURL", item.VoiceURL.Replace(" ", ""));
             update_name_and_voiceurl.Parameters.AddWithValue("objId", item.ObjectId);
             update_name_and_voiceurl.ExecuteNonQuery();
         }
         connection.Close();
     }
 }