protected function generateImagePayload(
        $image, ?string $alt, array $extra, bool $default, bool $storage = false
    ): ?ResourceSettings  {
        $image = $this->createImageSettings($image, $alt, $extra, $default, $storage);

        if ($this->hasCachedImage($image)) {
            return $this->getCachedImage($image);
        }

        $image->hasRequiredSettings();

        if (!$storage && !$image instanceof RemoteSettings && !$this->exists($image->image, $image->theme)) {
            if (!$default && $this->themeIsDefault($image->theme)) {
                return $this->generateImagePayload($image, $alt, $extra, true);
            }

            $this->missing($image->image, $image->theme);

            // Null returned
            return $this->cacheImage($image);
        }

        return $this->cacheImage($image);
    }