You can also create some helper function to simplify the code public static void validateWriteRecordCheck(Common _record) { if (! _record.validateWrite()) { throw error(strFmt("Failed to write %1 table", tableId2pname(_record.TableId))); } } and implement a check with one line instead of 4 DEV::validateWriteRecordCheck(myOrderHeader);