Generalize the inject service method