implementation of insert record