extract adding case index reference to method
Merge pull request #1800 from dimagi/xform-refactor

extract adding case index reference to method