def build_dump_order(orm_class, orm_classes):
    """pass in an array, when you encounter a ref, call this method again with the array
    when something has no more refs, then it gets appended to the array and returns, each
    time something gets through the list they are added, but before they are added to the
    list it is checked to see if it is already in the listt"""
    if orm_class in orm_classes: return

    for field_name, field_val in orm_class.schema.fields.items():
        if field_val.is_ref():
            build_dump_order(field_val.schema.orm_class, orm_classes)

    if orm_class not in orm_classes:
        orm_classes.append(orm_class)
pass in an array, when you encounter a ref, call this method again with the array
    when something has no more refs, then it gets appended to the array and returns, each
    time something gets through the list they are added, but before they are added to the
    list it is checked to see if it is already in the listt