SI-7747 Refactoring to reduce the number of if-else