Renamed method isValid to validateRecord() and changed the return value to NULL since it already throws an exception, in case the validation failed. This refactoring eliminated unnecessary if statements.
Tested newly introduced validateRecord()