Remove duplicate code from utitilies helper