protected function getAttachmentsArray($message)
    {
        $attachments = array();

        foreach ($message->getChildren() as $entity) {
            if ($entity instanceof Swift_Attachment) {
                $attachments[] = array(
                    'name' => $entity->getFilename(),
                    'data' => $entity->getBody(),
                    'content_id' => "<{$entity->getContentType()}>"
                );
            }
        }

        return $attachments;
    }