[DF-4209] Entity code refactoring