Modified the save code to stop the save if an exception occurs.