LPS-45170

LPS-45170 Move logic and add tests