Refactoring to re-use code between remote and in-memory operations

This commit refactors the callable infrastructure for queries and
updates to re-use more code by introducing an additional level of
abstract class.  This allows us to simplify the actual code in the
specific remote/in-memory implementations and improves the
maintainability of the code.