public static IPushNotificationStorage Create(IMailboxSession mailboxSession, IXSOFactory xsoFactory, IOrganizationIdConvertor organizationIdConvertor)
        {
            ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession);
            ArgumentValidator.ThrowIfNull("xsoFactory", xsoFactory);
            IPushNotificationStorage pushNotificationStorage = PushNotificationStorage.Find(mailboxSession, xsoFactory);

            if (pushNotificationStorage != null)
            {
                return(pushNotificationStorage);
            }
            ArgumentValidator.ThrowIfNull("mailboxSession.MailboxOwner", mailboxSession.MailboxOwner);
            ArgumentValidator.ThrowIfNull("organizationIdConvertor", organizationIdConvertor);
            if (ExTraceGlobals.StorageNotificationSubscriptionTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <string>(0L, "PushNotificationStorage.Create: Creating a new Notification Subscription folder for user {0}.", (mailboxSession.MailboxOwner.ObjectId != null) ? mailboxSession.MailboxOwner.ObjectId.ToDNString() : string.Empty);
            }
            StoreObjectId folderId = mailboxSession.CreateDefaultFolder(DefaultFolderType.PushNotificationRoot);
            IFolder       folder   = xsoFactory.BindToFolder(mailboxSession, folderId);

            return(new PushNotificationStorage(folder, PushNotificationStorage.GetTenantId(mailboxSession), xsoFactory));
        }
        public static IPushNotificationStorage Find(IMailboxSession mailboxSession, IXSOFactory xsoFactory)
        {
            ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession);
            ArgumentValidator.ThrowIfNull("xsoFactory", xsoFactory);
            StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.PushNotificationRoot);

            if (defaultFolderId != null)
            {
                return(new PushNotificationStorage(xsoFactory.BindToFolder(mailboxSession, defaultFolderId), PushNotificationStorage.GetTenantId(mailboxSession)));
            }
            return(null);
        }
 internal static PushNotificationStorage GetNotificationFolderRoot(Folder folder)
 {
     return(new PushNotificationStorage(folder, PushNotificationStorage.GetTenantId(folder.Session)));
 }