provide support to export entities with all its references

Solves #14 
Well, you probably can do that a little bit nicer here, but we write down to the disk, so even just measuring the improvement would be hard :)