protected function ensureFieldIds()
    {
        if ($this->submitModelName) {
            $formName = Inflector::slug($this->submitModelName, '_');
        } else {
            $model = new \ReflectionClass($this->model);
            $formName = $model->getShortName();
        }
        $parts = [];
        preg_match_all('/{([^}]+)}/', $this->template, $parts);
        $keys = array_flip($parts[1]);
        $fieldIds = [];
        if (isset($keys['country'])) {
            $fieldIds['country'] = $formName . '_country_id';
        }
        if (isset($keys['state'])) {
            $fieldIds['state'] = $formName . '_state_id';
        }
        if (isset($keys['region'])) {
            $fieldIds['region'] = $formName . '_region_id';
        }
        if (isset($keys['city'])) {
            $fieldIds['city'] = $formName . '_city_id';
        }
        if (isset($keys['address'])) {
            $fieldIds['address'] = $formName . '_address';
        }
        if (isset($keys['postalCode'])) {
            $fieldIds['postal_code'] = $formName . '_postal_code';
        }
        if (isset($keys['geolocation'])) {
            $fieldIds['latitude'] = $formName . '_latitude';
            $fieldIds['longitude'] = $formName . '_longitude';
        }
        $this->fieldIds = $fieldIds;
    }