Introduce helper class for simplifying code in various places.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>