If you use OptPath the same class should help you with this validation so maybe you dont need to do it :)