class ChildEnvironmentService {

    public void attachChildEnvironment(AttachChildEnvironmentRequest request, String accountId) {
        Stack stack = stackService.getByOwnEnvironmentCrnAndAccountIdWithLists(request.getParentEnvironmentCrn(), accountId);
        MDCBuilder.buildMdcContext(stack);
        LOGGER.info("Attaching child [{}] environment to parent env [{}]", request.getChildEnvironmentCrn(), request.getParentEnvironmentCrn());
        ChildEnvironment childEnvironment = new ChildEnvironment();
        childEnvironment.setEnvironmentCrn(request.getChildEnvironmentCrn());
        childEnvironment.setStack(stack);
        repository.save(childEnvironment);
    }

}