LPS-51848 Refactor to reuse logic