protected function createResponsiveSet($config, $defaultArgs, $set)
    {
        Requirements::javascript('heyday/silverstripe-responsive-images:javascript/picturefill/picturefill.min.js');

        if (!isset($config['arguments']) || !is_array($config['arguments'])) {
            throw new Exception("Responsive set $set does not have any arguments defined in its config.");
        }

        if (empty($defaultArgs)) {
            if (isset($config['default_arguments'])) {
                $defaultArgs = $config['default_arguments'];
            } else {
                $defaultArgs = Config::inst()->get(__CLASS__, 'default_arguments');
            }
        }

        if (isset($config['method'])) {
            $methodName = $config['method'];
        } else {
            $methodName = Config::inst()->get(__CLASS__, 'default_method');
        }


        if (!$this->owner->hasMethod($methodName)) {
            throw new RuntimeException(get_class($this->owner) . ' has no method ' . $methodName);
        }

        // Create the resampled images for each query in the set
        $sizes = ArrayList::create();
        foreach ($config['arguments'] as $query => $args) {
            if (is_numeric($query) || !$query) {
                throw new Exception("Responsive set $set has an empty media query. Please check your config format");
            }

            if (!is_array($args) || empty($args)) {
                throw new Exception("Responsive set $set doesn't have any arguments provided for the query: $query");
            }

            $sizes->push(ArrayData::create([
                'Image' => $this->getResampledImage($methodName, $args),
                'Query' => $query
            ]));
        }

        $templatePath = isset($config['template']) ? $config['template'] : 'Includes/ResponsiveImageSet';

        return $this->owner->customise([
            'Sizes' => $sizes,

            'DefaultImage' => $this->getResampledImage($methodName, $defaultArgs)
        ])->renderWith($templatePath);
    }