Refactoring asyncAppendFileWithData: method.