LPS-39724 Consolidate duplicate code