Separate method to create attachment for the sake of reusability #4697

unnecessary variable. Do direct assignment.