Sample implementation from http://www.udidahan.com/2012/12/10/service-oriented-api-implementations/