change error code to 409 and check the condition