How to layout figures in CairoMakie after they are generated

Note: Question on slack that I reposting here for wider audience.

Is there a way to layout figures in CairoMakie after they are generated? e.g. I have

julia> typeof(a1)
Figure

julia> typeof(a2)
Figure

I want to snap these together horizontally or vertically, basically layout Figure s
(I know I can do this while generating the actual figure, but curious if there was a layout option)

The answer below was posted by @sdanisch . this would be a useful feature in the ecosystem IMO.

“I made a little helper function for that some time ago”

function reparent(f::AbstractPlotting.FigurePosition, fig)
    ax = Axis(f.fig; fig.axis.attributes...)
    f.gp[] = ax
    for p in fig.axis.scene.plots
        plot!(ax, typeof(p), p.attributes, p.input_args...)
    end
    return ax
end
f = Figure()
reparent(f[1, 1], fig)
reparent(f[1, 2], fig2)
display(f)

Does that do what you want though? It seems an axis gets created and stuff replotted into it, but what about figures that have multiple axes, colorbars, etc? Also, a normal figure doesn’t even have an axis field, maybe this was meant for a FigureAxisPlot only