Extract creating the response with error status into the CreateErrorResponse method.