public void UpdateActivityAsync(Action<BackgroundActivitiesPastModel> success, Action<HealthGraphException> failure, BackgroundActivitiesPastModel activityToUpdate)
 {
     var request = PrepareActivityUpdateRequest(activityToUpdate);
     _tokenManager.ExecuteAsync<BackgroundActivitiesPastModel>(request, success, failure);
 }
        /// <summary>
        /// Prepares the request object to update an existing model.
        /// </summary>
        /// <param name="activityToUpdate"></param>
        /// <returns></returns>
        private IRestRequest PrepareActivityUpdateRequest(BackgroundActivitiesPastModel activityToUpdate)
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = activityToUpdate.Uri;

            ValidateModel(activityToUpdate);

            //Add body to the request
            request.AddParameter(BackgroundActivitiesPastModel.ContentType, _tokenManager.DefaultJsonSerializer.Serialize(new
            {
                calories_burned = activityToUpdate.CaloriesBurned,
                steps = activityToUpdate.Steps
            }), ParameterType.RequestBody);
            return request;
        }
 public BackgroundActivitiesPastModel UpdateActivity(BackgroundActivitiesPastModel activityToUpdate)
 {
     var request = PrepareActivityUpdateRequest(activityToUpdate);
     return _tokenManager.Execute<BackgroundActivitiesPastModel>(request);
 }