It will be great if you can add a function to convert objects on map to KML
and return the KML string .
This way it will be feasible to save the KML in database directly and then retrieve it and publish it easily again.
I don't really know the kml features
you could get whatever you need from map and ajax the data to server and convert it there