private void UpdateUserRating() { if (rating != null) { rating.Value = userRating; } if (userRating < 1 || userRating > 5) { return; } RestClient.ExecuteAsync <Rating>( rating == null? RequestFactory.AddRatingRequest(new Rating() { EntityType = EntityType.SONG, EntityId = Model.Id, Value = UserRating, User = LoginSession.Authentication.User }) : RequestFactory.UpdateRatingRequest(rating), (resp, handle) => { if (resp.Succeeded()) { rating = resp.Data; var resp2 = RestClient.Execute <double>(RequestFactory.AverageRatingRequest(EntityType.SONG, Model.Id)); if (resp2.Succeeded()) { AverageRating = resp2.Data; } else { ApplicationViewModel.HandlExceptionResponse(resp2.ExceptionResponse()); } } else { ApplicationViewModel.HandlExceptionResponse(resp.ExceptionResponse()); } }); }