refectoring Api service