API-69 Refactor and extract common classes for local and remote calls