/// <summary>
 /// Clean child record.
 /// <param name="record">The record to be cleared</param>
 /// </summary>
 private void CleanChildRecord(TPC.CalendarRecord record)
 {
     if (record.GetChildRecordCount(Event.Alarm) > 0)
     {
         var alarm = record.GetChildRecord(Event.Alarm, 0);
         record.RemoveChildRecord(Event.Alarm, alarm);
     }
 }
        /// <summary>
        /// Get item from record.
        /// <param name="record">The record</param>
        /// <param name="item">The item to be converted from record.</param>
        /// </summary>
        private void RecordToItem(TPC.CalendarRecord record, RecordItem item, TPC.CalendarTime start, TPC.CalendarTime end, bool isAllday)
        {
            item.Index       = record.Get <int>(Event.Id);
            item.Summary     = record.Get <string>(Event.Summary);
            item.Location    = record.Get <string>(Event.Location);
            item.Description = record.Get <string>(Event.Description);
            item.Priority    = getPriorityIndex(record.Get <int>(Event.Priority));
            item.Sensitivity = getSensitivityIndex(record.Get <int>(Event.Sensitivity));
            item.Status      = getStatusIndex(record.Get <int>(Event.EventStatus));

            item.StartTime  = isAllday == true ? start.LocalTime : start.UtcTime;
            item.EndTime    = isAllday == true ? end.LocalTime : end.UtcTime;
            item.IsAllday   = isAllday;
            item.Recurrence = getRecurrenceIndex(record.Get <int>(Event.Freq));

            item.DisplayTime = String.Format("{0} - {1}",
                                             item.IsAllday == true ? item.StartTime.ToLocalTime().ToString("yyyy/MM/dd") : item.StartTime.ToLocalTime().ToString("yyyy/MM/dd HH:mm"),
                                             item.IsAllday == true ? item.EndTime.ToLocalTime().ToString("yyyy/MM/dd") : item.EndTime.ToLocalTime().ToString("yyyy/MM/dd HH:mm"));

            if (item.Recurrence > 0)
            {
                switch (record.Get <int>(Event.RangeType))
                {
                default:
                /// count
                case (int)TPC.CalendarTypes.RangeType.Count:
                    item.UntilType  = 0;
                    item.UntilCount = record.Get <int>(Event.Count);
                    break;

                /// until
                case (int)TPC.CalendarTypes.RangeType.Until:
                    item.UntilType = 1;
                    var until = record.Get <TPC.CalendarTime>(Event.Until);
                    item.UntilTime = until.UtcTime;
                    break;
                }
            }

            if (record.Get <int>(Event.HasAlarm) > 0)
            {
                var alarm = record.GetChildRecord(Event.Alarm, 0);
                item.Reminder = getReminderIndex(alarm.Get <int>(Alarm.Tick), alarm.Get <int>(Alarm.TickUnit));
            }
        }