add error handle to create and updated