// PUT api/Task/5
        public HttpResponseMessage PutTask(int id, TaskViewModel task)
        {
            if (ModelState.IsValid && id == task.TaskID)
            {
                var entity = new Task
                {
                    TaskID = task.TaskID,
                    Title = task.Title,
                    Start = task.Start,
                    StartTimezone = task.StartTimezone,
                    End = task.End,
                    EndTimezone = task.EndTimezone,
                    Description = task.Description,
                    RecurrenceRule = task.RecurrenceRule,
                    RecurrenceException = task.RecurrenceException,
                    RecurrenceID = task.RecurrenceID,
                    IsAllDay = task.IsAllDay,
                    OwnerID = task.OwnerID
                };

                db.Tasks.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
        // POST api/Task
        public HttpResponseMessage PostTask(TaskViewModel task)
        {
            if (ModelState.IsValid)
            {
                var entity = new Task
                {
                    TaskID = task.TaskID,
                    Title = task.Title,
                    Start = task.Start,
                    StartTimezone = task.StartTimezone,
                    End = task.End,
                    EndTimezone = task.EndTimezone,
                    Description = task.Description,
                    RecurrenceRule = task.RecurrenceRule,
                    RecurrenceException = task.RecurrenceException,
                    RecurrenceID = task.RecurrenceID,
                    IsAllDay = task.IsAllDay,
                    OwnerID = task.OwnerID
                };

                db.Tasks.Add(entity);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, new { Data = new[] { task }, Total = 1 });
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = task.TaskID }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }