better error message during entityType construction for missing key prop + refactoring