public Invitation CreateInvitation(Invitation invitation)
        {
            var config        = Catalog.Factory.Resolve <IConfig>();
            var defaultDbName = config[CommonConfiguration.DefaultDataDatabase];

            if (defaultDbName.Equals(invitation.Tenancy, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new BusinessLogicException("The core database cannot be used as tenancy name.");
            }

            //Create the tenant when invitation has been sent (Only for SuperAdmin and TenantOwner Role).
            if (invitation.InvitingTenant == Tenants.SuperAdmin && invitation.Role == DefaultRoles.TenantOwner)
            {
                TenantHelper.GetOrCreate(invitation.Tenancy);
            }

            return(invitationManager.CreateInvitation(invitation));
        }