private void RefreshMovies()
        {
            MovieToCreate = new MovieModel();

            #if SILVERLIGHT_4
            template.GetForObjectAsync<IEnumerable<MovieModel>>("movies",
                r =>
                {
                    if (r.Error == null)
                    {
                        Movies = new ObservableCollection<MovieModel>(r.Response);
                    }
                });
            #else
            // Using Task Parallel Library (TPL)
            template.GetForObjectAsync<IEnumerable<MovieModel>>("movies")
                .ContinueWith(task =>
                {
                    if (!task.IsFaulted)
                    {
                        Movies = new ObservableCollection<MovieModel>(task.Result);
                    }
                }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()); // execute on UI thread
            #endif
        }
 private void CreateMovie(MovieModel movie)
 {
     #if SILVERLIGHT_4
     template.PostForLocationAsync("movie", movie,
         r =>
         {
             if (r.Error == null)
             {
                 RefreshMovies();
             }
         });
     #else
     // Using Task Parallel Library (TPL)
     template.PostForLocationAsync("movie", movie)
         .ContinueWith(task =>
         {
             if (!task.IsFaulted)
             {
                 RefreshMovies();
             }
         }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()); // execute on UI thread
     #endif
 }