docs: public Record updateRecord(BaseTable table, boolean bIsMainHasReferenceField)
      {
      	Record record = table.getRecord();
          Object objCounterData = null;
          if (record != null)
          {   // Field updating done, write the record to disk
              boolean bAutoSeqEnabled = true;
              try   {
                  if (record.getEditMode() == DBConstants.EDIT_ADD)
                  {
                      if (record.getCounterField() != null) if (((CounterField)record.getCounterField()).isModified())
                      {
                          bAutoSeqEnabled = false;
                          record.getTable().setProperty(SQLParams.AUTO_SEQUENCE_ENABLED, DBConstants.FALSE);        // Disable autosequence
                          objCounterData = record.getCounterField().getData();
                      }
                      try   {
                          table.add(record);
                      } catch (DBException ex)    {
                          if ((ex.getErrorCode() == DBConstants.DUPLICATE_KEY)
                              && (m_bOverwriteDups)
                                  && ((record.getCounterField() == null) || (!bAutoSeqEnabled)))
                          {
                              BaseBuffer buff = new VectorBuffer(new Vector<Object>()); // pend(don) ouch, serious performance hit.
                              buff.fieldsToBuffer(record);
                              record.setKeyArea(DBConstants.MAIN_KEY_AREA);
                              if (table.seek("="))
                              {   // Always
                              	table.remove();
                              	table.addNew();
                                  buff.bufferToFields(record, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE);
                                  table.add(record);
                              }
                              buff.free();
                          }
                          else
                          	ex.printStackTrace();
                      }
                      if (bIsMainHasReferenceField) if (bAutoSeqEnabled)
                      {   // Need to return the new record
                          table.setHandle(table.getLastModified(DBConstants.DATA_SOURCE_HANDLE), DBConstants.DATA_SOURCE_HANDLE); // Get this record, so I can get the bookmark
                          bIsMainHasReferenceField = false; // So seek won't be done at end
                      }
                  }
                  else
                  	table.set(record);
              } catch (DBException ex)    {
                  if (!bIsMainHasReferenceField)
                      ex.printStackTrace();
              } finally {
                  if (record != null) if (!bAutoSeqEnabled)
                      record.getTable().setProperty(SQLParams.AUTO_SEQUENCE_ENABLED, DBConstants.TRUE);     // Re-enable autosequence
              }
          }
          if (bIsMainHasReferenceField)
          {
              try   {
                  if (objCounterData != null)
                      record.getCounterField().setData(objCounterData);
                  table.seek("="); // Get this record, so I can get the bookmark
              } catch (DBException ex)    {
                  ex.printStackTrace();
              }
          }
          return record;
      }