Export Web Parts using CSOM

When using remote provisioning solutions, you might need to export Web Parts. Did you know that you can do it using CSOM?