Adding test and refactor Api service abastrct