Adding some more robust checking for files in add and edit record