This seems more like model layer functionality to me given that it is doing validation.