abstract REST api from repository logic, moved JPA logic into separate component