protected function applyOrderAttachments(
        \Swift_Message $message,
        ApiOrderInterface $apiOrder = null,
        $sendXMLOrder = false
    ) {
        if ($apiOrder) {
            $pdf = $this->pdfManager->createOrderConfirmation($apiOrder);
            $pdfFileName = $this->pdfManager->getPdfName($apiOrder);
            $attachment = \Swift_Attachment::newInstance()
                ->setFilename($pdfFileName)
                ->setContentType('application/pdf')
                ->setBody($pdf);
            $message->attach($attachment);

            if ($sendXMLOrder) {
                $message->attach($this->createXMLAttachment($apiOrder));
            }
        }
    }