private static DocapiCommon.Document toProtoDocument(Document doc) {
        // TODO a lot of copying here... Consider adding Document serialization to OutputStream
        //  so that we can serialize directly into a ByteString.Output instance.
        return toProtoDocument(serializeDoc(doc));
    }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java