public Trail unmarshall(JsonUnmarshallerContext context) throws Exception {
    Trail trail = new Trail();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("Name", targetDepth)) {
          context.nextToken();
          trail.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("S3BucketName", targetDepth)) {
          context.nextToken();
          trail.setS3BucketName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("S3KeyPrefix", targetDepth)) {
          context.nextToken();
          trail.setS3KeyPrefix(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("SnsTopicName", targetDepth)) {
          context.nextToken();
          trail.setSnsTopicName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("IncludeGlobalServiceEvents", targetDepth)) {
          context.nextToken();
          trail.setIncludeGlobalServiceEvents(
              BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("IsMultiRegionTrail", targetDepth)) {
          context.nextToken();
          trail.setIsMultiRegionTrail(BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("HomeRegion", targetDepth)) {
          context.nextToken();
          trail.setHomeRegion(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("TrailARN", targetDepth)) {
          context.nextToken();
          trail.setTrailARN(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("LogFileValidationEnabled", targetDepth)) {
          context.nextToken();
          trail.setLogFileValidationEnabled(
              BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("CloudWatchLogsLogGroupArn", targetDepth)) {
          context.nextToken();
          trail.setCloudWatchLogsLogGroupArn(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("CloudWatchLogsRoleArn", targetDepth)) {
          context.nextToken();
          trail.setCloudWatchLogsRoleArn(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("KmsKeyId", targetDepth)) {
          context.nextToken();
          trail.setKmsKeyId(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }
      token = context.nextToken();
    }

    return trail;
  }