Modified the code for delete record