public static InstagramOAuthPreValueOptions Get(string contentTypeAlias, string propertyAlias)
        {
            IDictionary <string, string> prevalues = PreValueHelpers.GetPreValues(contentTypeAlias, propertyAlias);

            string config;

            prevalues.TryGetValue("config", out config);

            try {
                return(JsonConvert.DeserializeObject <InstagramOAuthPreValueOptions>(config));
            } catch (Exception) {
                return(new InstagramOAuthPreValueOptions());
            }
        }
        public static InstagramOAuthPreValueOptions Get(string contentTypeAlias, string propertyAlias)
        {
            IDictionary <string, string> prevalues = PreValueHelpers.GetPreValues(contentTypeAlias, propertyAlias);

            string config;

            prevalues.TryGetValue("config", out config);

            try {
                // Parse the JSON for the config/prevalues
                JObject obj = JObject.Parse(config);

                // Determine the scope
                InstagramScope scope = default(InstagramScope);
                foreach (string alias in (obj.GetString("scope") ?? "").Split(','))
                {
                    switch (alias)
                    {
                    case "public_content": scope |= InstagramScope.PublicContent; break;

                    //case "follower_list": scope |= InstagramScope.FollowerList; break;
                    case "comments": scope |= InstagramScope.Comments; break;

                    case "relationships": scope |= InstagramScope.Relationships; break;

                    case "likes": scope |= InstagramScope.Likes; break;
                    }
                }

                // Initialize a new instance of the options class
                return(new InstagramOAuthPreValueOptions {
                    JObject = obj,
                    ClientId = obj.GetString("clientid"),
                    ClientSecret = obj.GetString("clientsecret"),
                    RedirectUri = obj.GetString("redirecturi"),
                    Scope = scope,
                    ScopeStr = obj.GetString("scope") ?? ""
                });
            } catch (Exception) {
                return(new InstagramOAuthPreValueOptions());
            }
        }