added logic to find table and first entity