public function actionSaveField()
    {
        $this->requirePostRequest();

        $fieldsService = Craft::$app->getFields();
        $request = Craft::$app->getRequest();
        $type = $request->getRequiredBodyParam('type');

        $field = $fieldsService->createField([
            'type'                 => $type,
            'id'                   => $request->getBodyParam('fieldId'),
            'groupId'              => $request->getRequiredBodyParam('group'),
            'name'                 => $request->getBodyParam('name'),
            'handle'               => $request->getBodyParam('handle'),
            'instructions'         => $request->getBodyParam('instructions'),
            'translationMethod'    => $request->getBodyParam('translationMethod', Field::TRANSLATION_METHOD_NONE),
            'translationKeyFormat' => $request->getBodyParam('translationKeyFormat'),
            'settings'             => $request->getBodyParam('types.' . $type),
        ]);

        if (!$fieldsService->saveField($field)) {
            return $this->asJson(['success' => false, 'error' => $field->getErrors()]);
        }

        return $this->asJson(['success' => true]);
    }