Refactored handle of user response in confirmation dialog for file removal to avoid duplication