Add ProfileRepository and refactor the implementation of the repository pattern