Refactor - Move duplicate code to a parent class

Signed-off-by: Bimal Yashodha <kb.yashodha@gmail.com>