refactoring CRUD to repository