Refactor inputValidator. Check nested objects recursive