refactor case block to make it more reusable
Merge pull request #1797 from dimagi/refactor-caseblock

refactor case block to make it more reusable