private void OnAddPhotoAsFavourite(object sender, AddFavouriteEventArgs e)
        {
            Photo photo = PhotoCache[e.PhotoId];
            photo.IsFavourite = true;

            if (FavouriteList.Contains(photo))
                FavouriteList.Insert(0, photo);

            TotalFavouritePhotosCount++;

            var evt = new PhotoAddedAsFavouriteEventArgs();
            evt.PhotoId = photo.ResourceId;
            PhotoAddedAsFavourite.DispatchEvent(this, evt);
        }
        public void AddPhotoToFavouriteAsync(string photoId)
        {
            string timestamp = DateTimeUtils.GetTimestamp();
            string nonce = Guid.NewGuid().ToString().Replace("-", null);

            Dictionary<string, string> paramDict = new Dictionary<string, string>();
            paramDict["method"] = "flickr.favorites.add";
            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["photo_id"] = photoId;

            string signature = OAuthCalculateSignature("POST", "https://api.flickr.com/services/rest/", paramDict, AccessTokenSecret);
            paramDict["oauth_signature"] = signature;

            DispatchPostRequest("POST", "https://api.flickr.com/services/rest/", paramDict,
                (response) =>
                {
                     bool success = true;
                    string errorMessage = "";

                    try
                    {
                        JObject json = JObject.Parse(response);
                        string status = json["stat"].ToString();
                        if (status != "ok")
                        {
                            success = false;
                            errorMessage = json["message"].ToString();
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e.Message);

                        success = false;
                    }

                    if (!success)
                    {
                        AddFavouriteExceptionEventArgs exceptionArgs = new AddFavouriteExceptionEventArgs();
                        exceptionArgs.PhotoId = photoId;
                        exceptionArgs.Message = errorMessage;
                        AddPhotoAsFavouriteException.DispatchEvent(this, exceptionArgs);
                    }
                    else
                    {
                        AddFavouriteEventArgs args = new AddFavouriteEventArgs();
                        args.PhotoId = photoId;
                        AddedPhotoAsFavourite.DispatchEvent(this, args);
                    }


                }, (ex) =>
                {
                    AddFavouriteExceptionEventArgs exceptionArgs = new AddFavouriteExceptionEventArgs();
                    exceptionArgs.PhotoId = photoId;
                    exceptionArgs.Message = "Unknown network error";
                    AddPhotoAsFavouriteException.DispatchEvent(this, exceptionArgs);
                });
        }