Refactoring SAM REST Service