@Override
	byte getCallingConventionId(String name, Consumer<String> conventionAdded) throws IOException {
		if (CompilerSpec.isUnknownCallingConvention(name)) {
			return UNKNOWN_CALLING_CONVENTION_ID;
		}
		else if (name.equals(CompilerSpec.CALLING_CONVENTION_default)) {
			return DEFAULT_CALLING_CONVENTION_ID;
		}
		populateCache();
		Byte id = callingConventionNameToIDMap.get(name);
		if (id != null) {
			return id;
		}

		byte newId = removeFirstAvailableKey();
		if (newId < 0) {
			Msg.error(this, "Unable to assign calling convention `" + name +
				"` - allocation capacity exceeded");
			return UNKNOWN_CALLING_CONVENTION_ID;
		}

		DBRecord record = V0_CALLING_CONVENTION_SCHEMA.createRecord(new ByteField(newId));
		record.setString(V0_CALLING_CONVENTION_NAME_COL, name);
		callingConventionTable.putRecord(record);

		callingConventionIDToNameMap.put(newId, name);
		callingConventionNameToIDMap.put(name, newId);
		conventionAdded.accept(name);
		return newId;
	}
Remove next available free key value from freeKeySet.
@return the next available key. A negative value indicates that all allowed IDs have 
been used.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/CallingConventionDBAdapterV0.java