public async void SearchPhotoAsync(string searchSessionId, string query = null, string tags = null, Dictionary<string, string> parameters = null)
        {
            string timestamp = DateTimeUtils.GetTimestamp();
            string nonce = Guid.NewGuid().ToString().Replace("-", null);

            Dictionary<string, string> paramDict = new Dictionary<string, string>();
            paramDict["method"] = "flickr.photos.search";
            paramDict["format"] = "json";
            paramDict["nojsoncallback"] = "1";
            paramDict["oauth_consumer_key"] = consumerKey;
            paramDict["oauth_nonce"] = nonce;
            paramDict["oauth_signature_method"] = "HMAC-SHA1";
            paramDict["oauth_timestamp"] = timestamp;
            paramDict["oauth_token"] = AccessToken;
            paramDict["oauth_version"] = "1.0";
            paramDict["extras"] = UrlHelper.Encode(commonExtraParameters);

            if (query != null)
                paramDict["text"] = UrlHelper.Encode(query);

            if (tags != null)
                paramDict["tags"] = UrlHelper.Encode(tags);

            if (parameters != null)
            {
                foreach (var entry in parameters)
                {
                    paramDict[entry.Key] = entry.Value;
                }
            }

            string paramString = GenerateParamString(paramDict);
            string signature = GenerateSignature("GET", AccessTokenSecret, "https://api.flickr.com/services/rest", paramString);
            string requestUrl = "https://api.flickr.com/services/rest?" + paramString + "&oauth_signature=" + signature;
            HttpWebResponse response = await DispatchRequest("GET", requestUrl, null).ConfigureAwait(false);
            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
            {
                if (response.StatusCode != HttpStatusCode.OK)
                {
                    HandleHTTPException(response);
                    return;
                }

                string jsonString = await reader.ReadToEndAsync().ConfigureAwait(false);
                if (!TryHandleResponseException(jsonString, () => { SearchPhotoAsync(searchSessionId, query, tags, parameters); }))
                    return;

                PhotoSearchEventArgs evt = new PhotoSearchEventArgs();
                evt.SearchSessionId = searchSessionId;
                evt.Response = jsonString;
                PhotoSearchReturned.DispatchEvent(this, evt);

            }
        }
        private void OnPhotoSearchReturned(object sender, PhotoSearchEventArgs e)
        {
            JObject json = JObject.Parse(e.Response);
            JObject photosetJson = (JObject)json["photos"];

            int page = int.Parse(photosetJson["page"].ToString());
            int perPage = int.Parse(photosetJson["perpage"].ToString());
            int numTotal = int.Parse(photosetJson["total"].ToString());

            List<Photo> photos = new List<Photo>();
            foreach (var photoJson in photosetJson["photo"])
            {
                Photo photo = PhotoFactory.PhotoWithJObject((JObject)photoJson);
                photos.Add(photo);
            }

            PhotoSearchResultEventArgs evt = new PhotoSearchResultEventArgs();
            evt.SearchSessionId = e.SearchSessionId;
            evt.Page = page;
            evt.PerPage = perPage;
            evt.TotalCount = numTotal;
            evt.Photos = photos;
            PhotoSearchCompleted.DispatchEvent(this, evt);
        }