Replaced getEntityById with getEntityByObject (class-check)