@SuppressWarnings("unchecked")
	public Event deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
		Event event = new Event();

		JsonObject jsonObject = json.getAsJsonObject();
		for(Map.Entry<String, JsonElement> entry: jsonObject.entrySet()) {
			String key = entry.getKey();
			JsonElement element = entry.getValue();
			if("previous_attributes".equals(key)) {
				Map<String, Object> previousAttributes = new HashMap<String, Object>();
				populateMapFromJSONObject(previousAttributes, element.getAsJsonObject());
				event.setPreviousAttributes(previousAttributes);
        	} else if ("result".equals(key)) {
				String type = element.getAsJsonObject().get("object").getAsString();
				Class<EasyPostResource> cl = objectMap.get(type);
				EasyPostResource result = EasyPostResource.gson.fromJson(entry.getValue(), cl);
				event.setResult(result);
			}
		}
        event.setId(jsonObject.get("id").getAsString());
        event.setDescription(jsonObject.get("description").getAsString());
        event.setMode(jsonObject.get("mode").getAsString());

		return event;
	}