(PDB-722) Small refactoring of validation function to make it more general