This code is duplicated on MethodValidator. Can you reuse it somehow?