Add attachment save function and delete unsaved