protected function getAttachmentsToProcess(AttachableInterface $model)
    {
        $attachments     = $model->getAttachedFiles();
        $attachmentNames = $this->option('attachments');

        $availableAttachmentNames = array_map(
            function (AttachmentInterface $attachment) {
                return $attachment->name();
            },
            $attachments
        );

        if (empty($attachmentNames)) {
            return $availableAttachmentNames;
        }

        $attachmentNames = explode(',', str_replace(', ', ',', $attachmentNames));

        $unavailableNames = array_diff($attachmentNames, $availableAttachmentNames);
        if (count($unavailableNames)) {
            throw new UnexpectedValueException(
                get_class($model) . ' does not have attachment(s): ' . implode(', ', $unavailableNames)
            );
        }

        return array_intersect($availableAttachmentNames, $attachmentNames);
    }