Added a way to search for entities by id.
Made add-entitity use next-id instead of next-count