public static ApiErrorException CreateApiErrorException(Error error, Response response)
		{
			var errorCode = (ErrorCode) error.Code;
			ApiErrorException apiException;

			if (error.Code >= 1000 && error.Code < 2000)
			{
				apiException = new InputParameterException(error.ErrorMessage, response, errorCode);
			}
			else if (error.Code >= 2000 && error.Code < 3000)
			{
				apiException = new InvalidResourceException(error.ErrorMessage, response, errorCode);
			}
			else if (error.Code >= 3000 && error.Code < 4000)
			{
				apiException = new UserCardException(error.ErrorMessage, response, errorCode);
			}
			else if ((error.Code >= 7000 && error.Code < 8000) || (error.Code >= 9000 && error.Code < 10000))
			{
				apiException = new RemoteApiException(error.ErrorMessage, response, errorCode);
			}
			else
			{
				throw new UnrecognisedErrorException(error.ErrorMessage, response);
			}

			return apiException;
		}
		public void Should_round_trip_serialise_and_deserialise_exception()
		{
			var headers = new Dictionary<string, string>
				{
					{"Header1", "Header1Value"},
					{"Header2", "Header2Value"}
				};
			var response = new Response(HttpStatusCode.OK, headers, "responseBody");

			var inputException = new UserCardException("user card has expired", response, ErrorCode.UserCardHasExpired);

			var roundTripSerialiser = new RoundTripSerialiser();
			var outputException = roundTripSerialiser.RoundTrip(inputException);

			Assert.That(outputException.Headers, Is.EqualTo(inputException.Headers));
			Assert.That(outputException.ResponseBody, Is.EqualTo(inputException.ResponseBody));
			Assert.That(outputException.StatusCode, Is.EqualTo(inputException.StatusCode));
			Assert.That(outputException.Message, Is.EqualTo(inputException.Message));
		}