Consolidated some duplicated code.

Case 85597: Consolidated some duplicated code.