Instead of htis logic being in the view, extract a helper/