Kotlin - return new inserted id from Room database using Persistence Room:runtime lib

If you're inserting multiple entities, you can only get their IDs back in an array or list, for example, like this:

@Insert
fun insertUsers(vararg userRegistrationEntities: UserRegistrationEntity): List<Long>

If you insert one entity at a time, you can get its ID back as a Long:

@Insert
fun insertUser(userRegistrationEntity: UserRegistrationEntity): Long

Based on the documentation here

A method annotated with the @Insert annotation can return:

long for single insert operation
long[] or Long[] or List<Long> for multiple insert operations
void if you don't care about the inserted id(s)