Factor out more helper methods.

[#51559097]
Merge 51559097- to master

[#51559097]