public static function saveUserProfileField($user_profile_field, $recursive = false)
 {
     $user_group_sid = $user_profile_field->getUserGroupSID();
     if ($user_group_sid) {
         $fieldID = false;
         $sid = $user_profile_field->getSID();
         if ($sid) {
             $fieldInfo = parent::getObjectInfo('user_profile_fields', $sid);
             if (!empty($fieldInfo['id'])) {
                 $fieldID = $fieldInfo['id'];
             }
         }
         parent::saveObject("user_profile_fields", $user_profile_field);
         $userFieldType = $user_profile_field->getPropertyValue('type');
         if ($userFieldType == 'location') {
             if (!$sid) {
                 $userProfileFeld = new SJB_UserProfileField(array('id' => 'Country', 'caption' => 'Country', 'type' => 'list'));
                 $userProfileFeld->setUserGroupSID($user_group_sid);
                 $userProfileFeld->addParentSID($user_profile_field->getSID());
                 self::saveUserProfileField($userProfileFeld, true);
                 $userProfileFeld = new SJB_UserProfileField(array('id' => 'State', 'caption' => 'State', 'type' => 'list'));
                 $userProfileFeld->setUserGroupSID($user_group_sid);
                 $userProfileFeld->addParentSID($user_profile_field->getSID());
                 self::saveUserProfileField($userProfileFeld, true);
                 $userProfileFeld = new SJB_UserProfileField(array('id' => 'City', 'caption' => 'City', 'type' => 'string'));
                 $userProfileFeld->setUserGroupSID($user_group_sid);
                 $userProfileFeld->addParentSID($user_profile_field->getSID());
                 self::saveUserProfileField($userProfileFeld, true);
                 $userProfileFeld = new SJB_UserProfileField(array('id' => 'ZipCode', 'caption' => 'ZipCode', 'type' => 'geo'));
                 $userProfileFeld->setUserGroupSID($user_group_sid);
                 $userProfileFeld->addParentSID($user_profile_field->getSID());
                 self::saveUserProfileField($userProfileFeld, true);
                 $userProfileFeld = new SJB_UserProfileField(array('id' => 'Address', 'caption' => 'Address', 'type' => 'string'));
                 $userProfileFeld->setUserGroupSID($user_group_sid);
                 $userProfileFeld->addParentSID($user_profile_field->getSID());
                 self::saveUserProfileField($userProfileFeld, true);
             }
             parent::saveLocationField("users", "user_profile_fields", $user_profile_field, $fieldID);
         } else {
             if (!$recursive) {
                 parent::saveField("users", "user_profile_fields", $user_profile_field, $fieldID);
             }
         }
         if ($user_profile_field->getOrder()) {
             return true;
         }
         $max_order = SJB_DB::queryValue("SELECT MAX(`order`) FROM user_profile_fields WHERE user_group_sid = ?n", $user_group_sid);
         $next_order = $max_order + 1;
         return SJB_DB::query("UPDATE user_profile_fields SET user_group_sid = ?n, `order` = ?n WHERE sid = ?n", $user_group_sid, $next_order, $user_profile_field->getSID());
     }
     return false;
 }