BS-11065 : Refactor code to reduce the complexity

- Add unit tests for ProcessAPIImpl & refactor it