Added a getEntities functions to get all entities with the same id