Refactor common utility code into CommandObjectUtils