added optional checking of record before storing