Change to a single command, using presave event listener to create directories if necessary.