Change remove_image to check if image is a dictionary and use Id value if it is.