I managed to get the initial result I am after using a similar method from this link.
Definitely not pretty and I will tune it as i tidy up the schema and develop my doc.