@model PlotLineWorkspaceViewModel @using System.Text.Json @{ var scenes = Model.AssociationScenes.OrderBy(s => s.NarrativeOrder).ToArray(); var payload = new { scenes = scenes.Select(s => new { id = s.SceneID, chapter = s.ChapterNumber, number = s.SceneNumber, title = s.SceneTitle }), lines = Model.PlotLines.Select(l => new { id = l.Line.PlotLineID, name = l.Line.PlotLineName, description = l.Line.Description, colour = l.Line.Colour }), memberships = Model.Scenes.SelectMany(s => s.Memberships.Select(m => new { scene = s.SceneID, line = m.PlotLineID, developments = m.Contributions.Select(c => new { id = c.ThreadEventID, thread = c.ThreadTitle, title = c.CanonicalTitle, detail = c.CanonicalDescription, role = c.CanonicalRole }) })) }; }