Update `serialize` method to not inlcuded empty compartments

Here's an updated PR to allow for embedded documents to not be required. This also ensures that empty compartments are not included in a serialized document.