This seems more like model layer functionality to me.