refactor couchapps sync

depends on https://github.com/dimagi/dimagi-utils/pull/97