public IHttpActionResult PutEventItem(int id, EventItem eventItem)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != eventItem.Id)
            {
                return BadRequest();
            }

            db.Entry(eventItem).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventItemExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostEventItem(EventItem eventItem)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.EventItems.Add(eventItem);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = eventItem.Id }, eventItem);
        }
        public ScheduleAppointment MapTo(EventItem eventItem)
        {
            if (eventItem == null)
            {
                return null;
            }

            var scheduleAppointment = new ScheduleAppointment
            {
                Subject = eventItem.Title,
                StartTime = eventItem.StartsAt,
                EndTime = eventItem.EndsAt,
                Notes = eventItem.Description,
                Location = eventItem.Location,
            };

            return scheduleAppointment;
        }