refactor: move API code used in both session & system in helper methods in 
common.