Move common code to helper function
Move common code to helper function

DeveloperMal/wger,wger-project/wger,petervanderdoes/wger,DeveloperMal/wger,petervanderdoes/wger,kjagoo/wger_stark,rolandgeider/wger,petervanderdoes/wger,petervanderdoes/wger,DeveloperMal/wger,rolandgeider/wger,wger-project/wger,wger-project/wger,rolandgeider/wger,kjagoo/wger_stark,kjagoo/wger_stark,DeveloperMal/wger,kjagoo/wger_stark,rolandgeider/wger,wger-project/wger