Here we check if a new file is going to be saved. If yes, we can delete the old file using the deleteOnUpdate action. However, without this fix all existing images for a record will be deleted if the record gets updated.