added try catch to delete api