Refactored the addAttachments into smaller methods that do one task only