Refacoting repository&service