Is it possible to abstract that function into a helper file like you would in Rails for example? I did some research and came across two solutions.