How to add layers to File3dm?

I am building a grasshopper component that exports objects directly to an external .3dm file. I am using File3dm to achieve this. I can add objects to the File3dmObject table, including the layer index, but I seem unable to add layers to the File3dm object. Is there any way to do that?

There is a LayerTable on the File3dm class which you should be able to call Add on. Something like

file.Layers.Add(mylayer);