LPS-22792 SF - avoid even more duplicated code

Hey @lipusz can you double check this is still fine? If it is, I can send to Brian.

thanks!