MDL-39397 badges: Handle course badges when course is deleted