Persisting complex datastructures to SQL tables