protected function save()
    {
        return function ($term_id) {
            /** @var Validator $validator */
            $validator = $this->validator->make(
                $this->getTermData(app('request')),
                $this->getTermRules(),
                $this->getTermMessages(),
                $this->getTermPlaceholders()
            );

            $validation = $validator->valid();

            foreach ($this->repository->all() as $field) {
                /** @var FieldTypeInterface|BaseType|CanHandleTerms $field */
                $field->setErrorMessageBag($validator->errors());

                if (method_exists($field, 'termSave')) {
                    $field->termSave($validation[$field->getName()] ?? null, $term_id);
                } else {
                    throw new TaxonomyException(
                        'Unable to save ['.$field->getName().']. The [termSave] method is missing.'
                    );
                }
            }
        };
    }