extracted request data validation to its own helper.