C sourceComponent = sourceEnvelope.getComponent();
Class<C> componentClass = (Class<C>) sourceComponent.getClass();
ComponentAdapter<C> componentAdapter = registeredComponentAdapter(componentClass);
// generate component id
EntityId componentId = entityIdFactory.newId();
// create component document using source data
ODocument componentDocument = db.newInstance(new OClassNameBuilder().type(componentClass).build());
componentAdapter.populateDocument(sourceComponent, componentDocument);
// amend component document with system-managed data
componentDocument.field(EntityAdapter.P_ID, componentId.asUniqueString());
Set<ORID> assets = ImmutableSet.of();
componentDocument.field(P_ASSETS, assets);
// store component document
componentDocument.save();
// create all associated assets and hold on to them, their entity ids, and rids
Set<EntityId> assetIds = Sets.newHashSet();
Set<ORID> assetDocumentRids = Sets.newHashSet();
for (A sourceAsset: sourceEnvelope.getAssets()) {
Class<A> assetClass = (Class<A>) sourceAsset.getClass();
AssetAdapter<A> assetAdapter = registeredAssetAdapter(assetClass);
// generate asset id
EntityId assetId = entityIdFactory.newId();
// create blob from source
Blob blob = createBlob(blobTx, sourceAsset, assetId);
checkArgument(blob != null, "Cannot store new asset without a content stream");