code: public static CompletionStage<Void> copy(final ServiceBundler services, final Session session,
              final Resource resource, final IRI destination, final String baseUrl) {
  
          final Metadata.Builder builder = Metadata.builder(destination)
              .interactionModel(resource.getInteractionModel());
          resource.getContainer().ifPresent(builder::container);
          resource.getBinaryMetadata().ifPresent(builder::binary);
          resource.getInsertedContentRelation().ifPresent(builder::insertedContentRelation);
          resource.getMemberOfRelation().ifPresent(builder::memberOfRelation);
          resource.getMemberRelation().ifPresent(builder::memberRelation);
          resource.getMembershipResource().ifPresent(builder::membershipResource);
  
          try (final Stream<Quad> stream = resource.stream(Trellis.PreferUserManaged)) {
              LOGGER.debug("Copying {} to {}", resource.getIdentifier(), destination);
              final TrellisDataset mutable = new TrellisDataset(stream.collect(toDataset()));
  
              return services.getResourceService().create(builder.build(), mutable.asDataset())
                  .whenComplete((a, b) -> mutable.close())
                  .thenCompose(future -> {
                          final TrellisDataset immutable = TrellisDataset.createDataset();
                          services.getAuditService().creation(resource.getIdentifier(), session).stream()
                              .map(skolemizeQuads(services.getResourceService(), baseUrl)).forEachOrdered(immutable::add);
  
                          return services.getResourceService().add(resource.getIdentifier(), immutable.asDataset())
                              .whenComplete((a, b) -> immutable.close());
                      })
                  .thenCompose(future -> services.getMementoService().put(services.getResourceService(),
                              resource.getIdentifier()))
                  .thenAccept(future -> services.getEventService().emit(new SimpleEvent(externalUrl(destination, baseUrl),
                              session.getAgent(), asList(PROV.Activity, AS.Create),
                              singletonList(resource.getInteractionModel()))));
          }
      }
docs: Copy a resource to another location.
  @param services the trellis services
  @param session the session
  @param resource the resource
  @param destination the destination identifier
  @param baseUrl the baseURL
  @return the next stage of completion