protected function register()
    {
        return function () {
            foreach ($this->repository as $field) {
                register_meta('term', $field->getName(), [
                    'type' => $field->getOption('data_type', 'string'),
                    'single' => ! $field->getOption('multiple', false),
                    'show_in_rest' => $field->getOption('show_in_rest', false),
                    'sanitize_callback' => $this->sanitize($field)
                ]);
            }
        };
    }