added service layer in between api and controller