move valid check to ApiModelResource