refactored repositories, added BaseRepository and BaseNamedRepository