changed all the references to instance to mainInstance and then added a vector of secondary instances.
changed all the references to instance to mainInstance and then added a vector of secondary instances.

dimagi/commcare,dimagi/commcare,dimagi/commcare-core,dimagi/commcare-core,dimagi/commcare,dimagi/commcare-core