Update EntityRepository
Code refactoring