Is it safe to do `to_i` here? I'd rather validate the input on the way in, otherwise we will get exceptions when writing the response rather than closer to where the error occurred.