public void Init()
        {
            ValidNutrition = new NutritionPastModel
            {
                Calories = 100
            };

            ValidNutritionNew = new NutritionNewModel
            {
                Timestamp = DateTime.Now,
                Calories = 100,
                PostToFacebook = null,
                PostToTwitter = null
            };
        }
 public void UpdateNutritionAsync(Action<NutritionPastModel> success, Action<HealthGraphException> failure, NutritionPastModel nutritionToUpdate)
 {
     var request = PrepareNutritionUpdateRequest(nutritionToUpdate);
     _tokenManager.ExecuteAsync<NutritionPastModel>(request, success, failure);
 }
        /// <summary>
        /// Prepares the request object to update an existing model.
        /// </summary>
        /// <param name="nutritionToUpdate"></param>
        /// <returns></returns>
        private IRestRequest PrepareNutritionUpdateRequest(NutritionPastModel nutritionToUpdate)
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = nutritionToUpdate.Uri;

            ValidateModel(nutritionToUpdate);

            //Add body to the request
            request.AddParameter(NutritionPastModel.ContentType, _tokenManager.DefaultJsonSerializer.Serialize(new
            {
                calories = nutritionToUpdate.Calories,
                carbohydrates = nutritionToUpdate.Carbohydrates,
                fat = nutritionToUpdate.Fat,
                fiber = nutritionToUpdate.Fiber,
                protein = nutritionToUpdate.Protein,
                sodium = nutritionToUpdate.Sodium,
                water = nutritionToUpdate.Water
            }), ParameterType.RequestBody);
            return request;
        }
 public NutritionPastModel UpdateNutrition(NutritionPastModel nutritionToUpdate)
 {
     var request = PrepareNutritionUpdateRequest(nutritionToUpdate);
     return _tokenManager.Execute<NutritionPastModel>(request);
 }