Move getEntityId into utils