String id = UUID.randomUUID().toString();
while (dao.exists(id)) {
id = UUID.randomUUID().toString();
}
final TodoBuilder builder = Todo.newBuilder().id(id).created(new Date());
if (email != null) {
builder.email(email);
}
dao.insert(builder.build());
return Response.created(URI.create(id)).build();
}