Made changes to support inserting a new record if a record id of 0 is passed in.