long taskId = entity.getKey().getId();
StableUserId userId = new StableUserId(entity.getParent().getName());
try {
return new ImportTask(userId, taskId,
DatastoreUtil.getExistingProperty(entity, TASK_CREATION_TIME_MILLIS_PROPERTY, Long.class),
GsonProto.fromGson(new ImportTaskPayloadGsonImpl(),
DatastoreUtil.getExistingProperty(entity, TASK_PAYLOAD_PROPERTY, Text.class)
.getValue()));
} catch (MessageException e) {
throw new RuntimeException("Failed to parse task entity: " + entity, e);
}