LPS-44232 part 1

Hey Brian,

I've decided to split the changes for this ticket into two pieces to make the review easier. This part contains mostly helper methods being used in the second part of the changes. We couldn't split it into separate tickets because they really belong together, but sending the changes in two different pulls makes it a bit easier.

Thanks,

Máté