updated code to handle related items and gallery content for the data
layer section of the code generation. added the table relationships
also.