LPS-40050 Extract common logic to a method