public static function processAttachments(array $attachments)
    {
        $processed = [];

        foreach ($attachments as $attachment) {
            if (!($attachment instanceof Attachment)) {
                throw new \InvalidArgumentException('Attachments must implement Stampie\\Attachment');
            }

            $name = $attachment->getName();

            if (isset($processed[$name])) {
                // Name conflict
                $name = static::findUniqueName($name, array_keys($processed));
            }

            $processed[$name] = $attachment;
        }

        return $processed;
    }