refactor to generic service