public virtual IEnumerable <string> GetUserPermissions(string userId, string accessToken)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId");
            }

            if (accessToken == null)
            {
                throw new ArgumentNullException("accessToken");
            }

            IEnumerable <string> permissions;
            FacebookClient       client = _config.ClientProvider.CreateClient();

            client.AccessToken = accessToken;
            IFacebookStorageProvider storage = _config.StorageProvider;

            if (storage != null)
            {
                UserPermissions userPermissions = storage.GetAsync(userId).Result as UserPermissions;
                if (userPermissions == null)
                {
                    userPermissions = new UserPermissions {
                        Id = userId
                    };
                    userPermissions.SetPermissions(client.GetCurrentUserPermissions());
                    storage.AddOrUpdateAsync(userId, userPermissions).Wait();
                }
                permissions = userPermissions.ParsePermissions();
            }
            else
            {
                permissions = client.GetCurrentUserPermissions();
            }

            return(permissions);
        }
        /// <summary>
        /// Gets the user permissions by calling the Facebook Graph API.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <param name="accessToken">The access token.</param>
        /// <returns>The user permissions.</returns>
        public virtual IEnumerable <string> GetUserPermissions(string userId, string accessToken)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId");
            }

            if (accessToken == null)
            {
                throw new ArgumentNullException("accessToken");
            }

            FacebookClient client = _config.ClientProvider.CreateClient();

            client.AccessToken = accessToken;
            return(client.GetCurrentUserPermissions());
        }