persist images to the database