Refactoring web service implementation for reusability.