LUN-670 -- optimezed format_recursive_msg method