@Override
	public VarKeyNode putRecord(DBRecord record, Table table) throws IOException {

		Field key = record.getKeyField();
		int index = getKeyIndex(key);

		// Handle record update case
		if (index >= 0) {
			if (table != null) {
				table.updatedRecord(getRecord(table.getSchema(), index), record);
			}
			VarKeyNode newRoot = updateRecord(index, record);
			return newRoot;
		}

		// Handle new record - see if we have room in this leaf
		index = -index - 1;
		if (insertRecord(index, record)) {
			if (index == 0 && parent != null) {
				parent.keyChanged(getKeyField(1), key, this);
			}
			if (table != null) {
				table.insertedRecord(record);
			}
			return getRoot();
		}

		// Special Case - append new leaf to right
		if (index == keyCount) {
			VarKeyNode newRoot = appendNewLeaf(record);
			if (table != null) {
				table.insertedRecord(record);
			}
			return newRoot;
		}

		// Split leaf and complete insertion
		VarKeyRecordNode leaf = split().getLeafNode(key);
		return leaf.putRecord(record, table);
	}
Append a leaf which contains one or more keys and update tree.  Leaf is inserted
as the new right sibling of this leaf.
@param leaf new right sibling leaf (must be same node type as this leaf)
@return root node which may have changed.
@throws IOException thrown if an IO error occurs
Ghidra/Framework/DB/src/main/java/db/VarKeyRecordNode.java