/// <summary>
        /// Prepares the request object to update an existing model.
        /// </summary>
        /// <param name="sleepToUpdate"></param>
        /// <returns></returns>
        private IRestRequest PrepareSleepUpdateRequest(SleepPastModel sleepToUpdate)
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = sleepToUpdate.Uri;

            ValidateModel(sleepToUpdate);

            //Add body to the request
            request.AddParameter(SleepPastModel.ContentType, _tokenManager.DefaultJsonSerializer.Serialize(new
            {
                awake = sleepToUpdate.Awake,
                deep = sleepToUpdate.Deep,
                light = sleepToUpdate.Light,
                rem = sleepToUpdate.Rem,
                times_woken = sleepToUpdate.TimesWoken,
                total_sleep = sleepToUpdate.TotalSleep
            }), ParameterType.RequestBody);
            return request;
        }
 public SleepPastModel UpdateSleep(SleepPastModel sleepToUpdate)
 {
     var request = PrepareSleepUpdateRequest(sleepToUpdate);
     return _tokenManager.Execute<SleepPastModel>(request);
 }
 public void UpdateSleepAsync(Action<SleepPastModel> success, Action<HealthGraphException> failure, SleepPastModel sleepToUpdate)
 {
     var request = PrepareSleepUpdateRequest(sleepToUpdate);
     _tokenManager.ExecuteAsync<SleepPastModel>(request, success, failure);
 }
        public void Init()
        {
            ValidSleep = new SleepPastModel
            {
                TotalSleep = 60
            };

            ValidSleepNew = new SleepNewModel
            {
                Timestamp = DateTime.Now,
                TotalSleep = 60,
                PostToFacebook = null,
                PostToTwitter = null
            };
        }