Entities now have a unique id that can be used to retrieve them

We use entity groups, so having a primitive type key is useful.
Maybe `++lastId` instead of `lastId++` so that 0 is also used.