Inlined initializeEntity