protected function detectPaperclipAttachments()
    {
        $model = $this->model();

        if ( ! ($model instanceof PaperclippableInterface)) {
            return [];
        }

        $files = $model->getAttachedFiles();

        $attachments = [];

        /** @var PaperclipAttachmentInstance[] $files */
        foreach ($files as $attribute => $file) {

            $variants = $file->variants();

            $normalizedVariants = [];

            foreach ($variants as $variant) {

                if ($variant === 'original') {
                    continue;
                }

                $normalizedVariants[ $variant ] = $this->extractPaperclipVariantInfo($file, $variant);
            }

            $attachments[ $attribute ] = new PaperclipAttachmentData([
                'image'      => (is_array($variants) && count($variants) > 1),
                'resizes'    => array_pluck($normalizedVariants, 'dimensions'),
                'variants'   => $variants,
                'extensions' => array_pluck($normalizedVariants, 'extension'),
                'types'      => array_pluck($normalizedVariants, 'mimeType'),
            ]);
        }

        return $attachments;
    }