public static void LoadPersonalizationBlobs(
            SiteSettings siteSettings,
            WebPartManager webPartManager,
            string path,
            string userName,
            ref byte[] sharedDataBlob,
            ref byte[] userDataBlob)
        {
            if (siteSettings != null)
            {
                if ((userName != null) && (userName.Length > 0))
                {
                    SiteUser siteUser = new SiteUser(siteSettings, userName);
                    Guid userID = Guid.Empty;
                    if (siteUser.UserId > 0)
                    {
                        userID = siteUser.UserGuid;
                    }

                    if (userID != Guid.Empty)
                    {
                        userDataBlob = SitePersonalization.GetPersonalizationBlob(
                            siteSettings.SiteId,
                            path,
                            userID);

                        siteUser.UpdateLastActivityTime();

                        sharedDataBlob = SitePersonalization.GetPersonalizationBlobAllUsers(
                            siteSettings.SiteId,
                            path);

                    }
                }
                else
                {
                    //TODO: tracking/personalization for unauthenticated users?

                    sharedDataBlob = SitePersonalization.GetPersonalizationBlobAllUsers(
                            siteSettings.SiteId,
                            path);

                }

            }
        }
        public static void ResetPersonalizationBlob(
            SiteSettings siteSettings,
            WebPartManager webPartManager,
            string path,
            string userName)
        {
            //if (userName == null) return;
            //if (userName.Length == 0) return;
            if (siteSettings == null) return;
            if (path == null) return;
            if (path.Length == 0) return;
            if (webPartManager == null) return;

            // delete personlization settings for this user for this path
            if (!String.IsNullOrEmpty(userName))
            {
                SiteUser siteUser = new SiteUser(siteSettings, userName);
                Guid userID = Guid.Empty;
                if (siteUser.UserId > -1)
                {
                    userID = siteUser.UserGuid;
                }

                if (userID != Guid.Empty)
                {
                    SitePersonalization.ResetPersonalizationBlob(
                        siteSettings.SiteId,
                        path,
                        userID);

                    siteUser.UpdateLastActivityTime();

                }
            }
            else
            {
                SitePersonalization.ResetPersonalizationBlob(
                        siteSettings.SiteId,
                        path);
            }
        }
        public override MembershipUser GetUser(string username, bool userIsOnline)
        {
            /*
             * 	Takes, as input, a user name or user ID (the method is overloaded) and a
             * Boolean value indicating whether to update the user's LastActivityDate to
             * show that the user is currently online. GetUser returns a MembershipUser object
             * representing the specified user. If the user name or user ID is invalid (that is, if
             * it doesn't represent a registered user) GetUser returns null (Nothing in Visual Basic).
             */
            SiteSettings siteSettings = GetSiteSettings();

            if ((siteSettings != null) && (username != null)&&(username.Length > 0))
            {
                SiteUser siteUser = null;
                siteUser = new SiteUser(siteSettings, username);
                if (siteUser.UserId > 0)
                {
                    if (siteUser.IsDeleted) { return null; }

                    if (userIsOnline)
                    {
                        siteUser.UpdateLastActivityTime();
                    }
                    return this.CreateMembershipUserFromSiteUser(siteUser);
                }
            }

            return null;
        }
        public static void SavePersonalizationBlob(
            SiteSettings siteSettings,
            WebPartManager webPartManager,
            string path,
            string userName,
            byte[] dataBlob)
        {
            if (siteSettings != null)
            {
                if ((userName != null) && (userName.Length > 0))
                {
                    SiteUser siteUser = new SiteUser(siteSettings, userName);
                    Guid userID = Guid.Empty;
                    if (siteUser.UserId > 0)
                    {
                        userID = siteUser.UserGuid;
                    }

                    if (userID != Guid.Empty)
                    {

                        SitePersonalization.SavePersonalizationBlob(
                            siteSettings.SiteId,
                            path,
                            userID,
                            dataBlob,
                            DateTime.Now);

                        siteUser.UpdateLastActivityTime();

                    }
                }
                else
                {
                    SitePersonalization.SavePersonalizationBlobAllUsers(
                        siteSettings.SiteId,
                        path,
                        dataBlob,
                        DateTime.Now);

                }
            }
        }
        public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
        {
            /*
             * Takes, as input, a user name or user ID (the method is overloaded) and a Boolean value
             * indicating whether to update the user's LastActivityDate to show that the user is currently online.
             * GetUser returns a MembershipUser object representing the specified user. If the user name or
             * user ID is invalid (that is, if it doesn't represent a registered user) GetUser returns null (Nothing in Visual Basic).
             */
            SiteSettings siteSettings = GetSiteSettings();
            if ((siteSettings != null)&&(providerUserKey != null))
            {
                SiteUser siteUser = null;
                if (providerUserKey is Guid)
                {
                    siteUser = new SiteUser(siteSettings, (Guid)providerUserKey);
                    if (siteUser.UserId > 0)
                    {
                        if (siteUser.IsDeleted) { return null; }

                        if (userIsOnline)
                        {
                            siteUser.UpdateLastActivityTime();
                        }
                        return this.CreateMembershipUserFromSiteUser(siteUser);
                    }

                }

                if (providerUserKey is int)
                {
                    siteUser = new SiteUser(siteSettings, (int)providerUserKey);
                    if (siteUser.UserId > 0)
                    {
                        if (siteUser.IsDeleted) { return null; }

                        if (userIsOnline)
                        {
                            siteUser.UpdateLastActivityTime();
                        }
                        return this.CreateMembershipUserFromSiteUser(siteUser);
                    }
                }

            }

            return null;
        }