make the patch work for non-standard primary keys
modification showing how save a tree of objects efficiently.