small refactoring in InsertEntity