protected function save($key, $value, $isNew = false, $brandId = false, $flag = null)
    {
        try {
            DB::transaction(function () use ($key, $value, $isNew, $brandId, $flag) {
                $name = str_replace('acl_antares/', '', $key);
                if (str_contains($key, 'acl_antares')) {

                    $this->resolver()->updatePermissions($name, $value, $isNew, $brandId);
                } elseif ($isNew) {
                    $name = isset($value['name']) ? $value['name'] : $name;

                    $model = $this->resolver()->component()->getModel()->newInstance();
                    $first = $model->query()->where('name', $name)->get()->first();

                    if (!is_null($first) and $first->exists) {
                        $model = $first;
                    }

                    $model->fill($value + ['status' => ($flag === 'active')]);
                    if (!$model->save()) {
                        throw new ComponentNotSavedException('Unable to save primary module configuration');
                    }
                }
            });
        } catch (Exception $e) {
            Log::emergency($e);
            throw new ComponentNotSavedException($e);
        }
    }