Reworked to entity repo