public new ITenantOperations ForTenant(string tenantId)
        {
            _byTenant ??= new Dictionary <string, NestedTenantSession>();

            if (_byTenant.TryGetValue(tenantId, out var tenantSession))
            {
                return(tenantSession);
            }

            var tenant = new Tenant(tenantId, Database);

            tenantSession       = new NestedTenantSession(this, tenant);
            _byTenant[tenantId] = tenantSession;

            return(tenantSession);
        }
        /// <summary>
        /// Access data from another tenant and apply document or event updates to this
        /// IDocumentSession for a separate tenant
        /// </summary>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        public ITenantOperations ForTenant(string tenantId)
        {
            if (_byTenant == null)
            {
                _byTenant = new Dictionary <string, NestedTenantSession>();
            }

            if (_byTenant.TryGetValue(tenantId, out var tenantSession))
            {
                return(tenantSession);
            }

            var tenant = Options.Tenancy[tenantId];

            tenantSession       = new NestedTenantSession(this, tenant);
            _byTenant[tenantId] = tenantSession;

            return(tenantSession);
        }