Refactor method call in utils.cpp

Refactored method calls in utils.cpp by introducing MethodCall class.