public function execute()
    {
        $result = $this->resultJson->create();
        try {
            $activate_flag = $this->getRequest()->getParam('activate_flag');
            $activeVersion = $this->getRequest()->getParam('active_version');
            $formData = $this->getRequest()->getParams();
            if (in_array("", $formData)) {
                return $result->setData([
                    'status'    => false,
                    'msg'       => 'Please fill in the required fields.'
                ]);
            }
            $service = $this->api->checkServiceDetails();
            $this->vcl->checkCurrentVersionActive($service->versions, $activeVersion);
            $currActiveVersion = $this->vcl->getCurrentVersion($service->versions);
            $clone = $this->api->cloneVersion($currActiveVersion);
            $id = $service->id . '-' . $clone->number . '-imageopto';

            $params = json_encode([
                'data' => [
                    'id' => $id,
                    'type' => 'io_settings',
                    'attributes' => [
                        'webp'          => $this->getRequest()->getParam('webp'),
                        'webp_quality'  => $this->getRequest()->getParam('webp_quality'),
                        'jpeg_type'     => $this->getRequest()->getParam('jpeg_type'),
                        'jpeg_quality'  => $this->getRequest()->getParam('jpeg_quality'),
                        'upscale'       => $this->getRequest()->getParam('upscale'),
                        'resize_filter' => $this->getRequest()->getParam('resize_filter')
                    ]
                ]
            ]);

            $configureIo = $this->api->configureImageOptimizationDefaultConfigOptions($params, $clone->number);

            if (!$configureIo) {
                return $result->setData([
                    'status'    => false,
                    'msg'       => 'Failed to update image optimization default config options.'
                ]);
            }

            $this->api->validateServiceVersion($clone->number);

            if ($activate_flag === 'true') {
                $this->api->activateVersion($clone->number);
            }
            if ($this->config->areWebHooksEnabled() && $this->config->canPublishConfigChanges()) {
                $this->api->sendWebHook('*Image optimization default config options have been updated*');
            }

            $comment = ['comment' => 'Magento Module updated the Image Optimization Default Configuration'];
            $this->api->addComment($clone->number, $comment);

            return $result->setData([
                'status'            => true,
                'active_version'    => $clone->number
            ]);
        } catch (\Exception $e) {
            return $result->setData([
                'status'    => false,
                'msg'       => $e->getMessage()
            ]);
        }
    }