Only add attachment key to hash if there are attachments