/// <summary>
        /// Draws alarm list
        /// </summary>
        /// <returns>Returns RelativeLayout</returns>
        protected virtual RelativeLayout Draw()
        {
            /// Need to get bindable context to assign list value
            AlarmRecord alarmData = (AlarmRecord)BindingContext;

            /// If binding context is null, can't proceed further action
            if (alarmData == null)
            {
                return(null);
            }

            alarmData.PrintProperty();

            /// Alarm item layout should be set if null
            if (alarmItemLayout == null)
            {
                // The layout of item cell
                alarmItemLayout = new RelativeLayout
                {
                    HeightRequest = 22 + 93 + 29,
                };

                // Time Label
                timeLabel = new Label()
                {
                    Text = (((App)Application.Current).Is24hourFormat) ?
                           alarmData.ScheduledDateTime.ToString("HH:mm") : alarmData.ScheduledDateTime.ToString("hh:mm"),
                    Style = alarmData.AlarmState == AlarmStates.Inactive ? AlarmStyle.ATO001D : AlarmStyle.ATO001,
                };
                // to meet To meet thin attribute for font, need to use custom feature
                FontFormat.SetFontWeight(timeLabel, FontWeight.Light);
                /// Style set for time label for normal case
                timeLabel.SetBinding(Label.StyleProperty, new Binding("AlarmState", BindingMode.Default, new AlarmStateToPropertyConverter(), AlarmModelComponent.Time));
                /// Needs to set binding context for scheduled time
                timeLabel.SetBinding(Label.TextProperty, new Binding("ScheduledDateTime", BindingMode.Default, new ScheduledDateTimeToTextConverter(), LabelType.Time));
                // Added to layout
                alarmItemLayout.Children.Add(timeLabel,
                                             Constraint.RelativeToParent((parent) =>
                {
                    return(32);
                }),
                                             Constraint.RelativeToParent((parent) =>
                {
                    return(22);
                }));

                // AM/PM Label
                amPmLabel = new Label()
                {
                    //the text of AM/PM label
                    Text = (((App)Application.Current).Is24hourFormat) ?
                           "" : alarmData.ScheduledDateTime.ToString("tt"),
                    Style = alarmData.AlarmState == AlarmStates.Inactive ? AlarmStyle.ATO002D : AlarmStyle.ATO002,
                };
                // to meet To meet thin attribute for font, need to use custom feature
                FontFormat.SetFontWeight(amPmLabel, FontWeight.Light);
                //amPmLabel.IsVisible = (((Tizen.App)Application.Current).Is24hourFormat) ? false : true;
                amPmLabel.SetBinding(Label.IsVisibleProperty, new Binding("AlarmDateFormat", BindingMode.Default, new DateFormatToVisibleConverter()));
                // Set style depending on alarm state
                amPmLabel.SetBinding(Label.StyleProperty, new Binding("AlarmState", BindingMode.Default, new AlarmStateToPropertyConverter(), AlarmModelComponent.AmPm));
                amPmLabel.SetBinding(Label.TextProperty, new Binding("ScheduledDateTime", BindingMode.Default, new ScheduledDateTimeToTextConverter(), LabelType.AmPm));
                // Added to layout
                alarmItemLayout.Children.Add(amPmLabel,
                                             Constraint.RelativeToView(timeLabel, (parent, sibling) => sibling.X + sibling.Width + 10),
                                             Constraint.RelativeToView(timeLabel, (parent, sibling) => sibling.Y + 36));

                // Repeat Image
                repeatImage = new Image
                {
                    Source        = "alarm/clock_ic_repeat.png",
                    WidthRequest  = 38,
                    HeightRequest = 38,
                };
                // Bind repeat Image's visibiliy to weekly repeating value
                repeatImage.SetBinding(Image.IsVisibleProperty, new Binding("Repeat", mode: BindingMode.Default));
                // Set repeat image's blending color on alarm state
                ImageAttributes.SetBlendColor(repeatImage, alarmData.AlarmState == AlarmStates.Inactive ? Color.FromHex("66000000") : Color.FromHex("FFFFFF"));
                repeatImage.SetBinding(ImageAttributes.BlendColorProperty, new Binding("AlarmState", BindingMode.OneWay, new AlarmStateToPropertyConverter(), AlarmModelComponent.Repeat));
                // Added to layout
                alarmItemLayout.Children.Add(repeatImage,
                                             Constraint.RelativeToParent((parent) => (720 - 104 - 32 - 268)),
                                             Constraint.RelativeToParent((parent) => (22 + 93) - (43 + 43)));

                /// Alarm Name Label
                alamNameLabel = new Label();
                /// For alarm name label, to meet To meet thin attribute for font, need to use custom feature
                FontFormat.SetFontWeight(alamNameLabel, FontWeight.Normal);
                /// Bind alarm lable's style to alarm state
                alamNameLabel.SetBinding(Label.StyleProperty, new Binding("AlarmState", BindingMode.OneWay, new AlarmStateToPropertyConverter(), AlarmModelComponent.Name));
                /// Bind label's text property to AlarmMode's AlarmName.
                alamNameLabel.SetBinding(Label.TextProperty, "AlarmName");
                // Update alarm name label's TranslationX property value according to repeat image's visibility
                alamNameLabel.SetBinding(Label.TranslationXProperty, new Binding("Repeat", BindingMode.OneWay, converter: new AlarmNameLabelPositionConverter()));
                // Bind alarm name label's visibility
                alamNameLabel.SetBinding(Label.IsVisibleProperty, new Binding("IsVisibleDateLabel", BindingMode.Default, new DateLabelVisibleToVisibility(), false));
                //alamNameLabel.Text = alarmData.AlarmName;
                // Added to relative layout
                alarmItemLayout.Children.Add(alamNameLabel,
                                             Constraint.RelativeToParent((parent) => (720 - 104 - 32 - 268)),
                                             Constraint.RelativeToParent((parent) => (22 + 93 - (43 + 43))));

                /// WeekDays Label
                weekDaysLabel = new Label()
                {
                    FormattedText = alarmData.GetFormatted(alarmData.WeekFlag, alarmData.AlarmState < AlarmStates.Inactive ? true : false),
                    IsVisible     = !alarmData.IsVisibleDateLabel,
                    Style         = alarmData.AlarmState == AlarmStates.Inactive ? AlarmStyle.ATO004D : AlarmStyle.ATO004,
                };
                // to meet To meet thin attribute for font, need to use custom feature
                FontFormat.SetFontWeight(weekDaysLabel, FontWeight.Normal);
                /// Style set for time label for normal case
                weekDaysLabel.SetBinding(Label.StyleProperty, new Binding("AlarmState", BindingMode.OneWay, new AlarmStateToPropertyConverter(), AlarmModelComponent.Weekly));
                /// Sets binding context for weekdays label
                weekDaysLabel.SetBinding(Label.FormattedTextProperty, new Binding("WeekdayRepeatText", BindingMode.Default));
                weekDaysLabel.SetBinding(Label.IsVisibleProperty, new Binding("IsVisibleDateLabel", BindingMode.Default, new DateLabelVisibleToVisibility(), false));
                /// Adds to relative layout
                alarmItemLayout.Children.Add(weekDaysLabel,
                                             Constraint.RelativeToParent((parent) => (720 - 104 - 32 - 268)),
                                             Constraint.RelativeToParent((parent) => (22 + 93) - 43));

                // Date label
                // DateLabel is only visible when the alarm name is empty and repeat weekly is Never.
                dateLabel = new Label
                {
                    Text = alarmData.ScheduledDateTime.ToString("ddd, d MMM"),
                };
                // to meet To meet thin attribute for font, need to use custom feature
                FontFormat.SetFontWeight(dateLabel, FontWeight.Normal);
                dateLabel.SetBinding(Label.IsVisibleProperty, new Binding("IsVisibleDateLabel", BindingMode.Default, new DateLabelVisibleToVisibility(), true));
                dateLabel.SetBinding(Label.StyleProperty, new Binding("AlarmState", BindingMode.Default, new AlarmStateToPropertyConverter(), AlarmModelComponent.Date));
                alarmItemLayout.Children.Add(dateLabel,
                                             Constraint.RelativeToParent((parent) => (720 - 104 - 32 - 268)),
                                             Constraint.RelativeToParent((parent) => 22));

                /// Switch object to represent that the alarm is active or not
                switchObj = new Switch
                {
                    HeightRequest = 72,
                    WidthRequest  = 72,
                    IsToggled     = alarmData.AlarmState == AlarmStates.Inactive ? false : true,
                };
                /// Bind IsToggled property to alarm state
                //switchObj.SetBinding(Switch.IsToggledProperty, new Binding("AlarmState", BindingMode.OneWay, new AlarmStateToPropertyConverter(), AlarmModelComponent.State));
                /// Adds to relative layout
                alarmItemLayout.Children.Add(switchObj,
                                             Constraint.RelativeToParent((parent) =>
                {
                    return(720 - 104);
                }),
                                             Constraint.RelativeToParent((parent) =>
                {
                    return(22 + 93 - 72);
                }));

                /// Adds an event
                switchObj.Toggled += (s, e) =>
                {
                    //Switch sObj = s as Switch;
                    ///// Needs valid parent to proceed
                    //if (sObj.Parent == null || sObj.Parent.Parent == null)
                    //{
                    //    return;
                    //}

                    ///// Need binding context to check state
                    //AlarmRecord am = (AlarmRecord)((AlarmListCell)sObj.Parent.Parent).BindingContext;
                    //if (am == null)
                    //{
                    //    return;
                    //}
                    AlarmRecord am = (AlarmRecord)BindingContext;
                    /// Modify state and re-draw it. Redraw must be called to redraw
                    //am.AlarmState = e.Value ? AlarmStates.Active : AlarmStates.Inactive;
                    if (e.Value)
                    {
                        AlarmModel.ReactivatelAlarm(am);
                    }
                    else
                    {
                        AlarmModel.DeactivatelAlarm(am);
                    }

                    AlarmModel.PrintAll("After switch is toggled...");
                };
            }
            else
            {
                switchObj.IsVisible = true;
            }

            return(alarmItemLayout);
        }
        // When button clicked, need to do followings:
        // 1. check time set by users
        // 2. convert TimeSpan to DateTime (since epoc time)
        // 3. get alarm name
        // 4. get alarm key (creation date which identify alarm uniquely)
        // 5. save a new record or update existing alarm.
        /// <summary>
        /// Invoked when "DONE" button is clicked
        /// </summary>
        /// <param name="sender">Titlebar's right button(DONE button)</param>
        /// <param name="e">EventArgs</param>
        private void DONE_Clicked(object sender, EventArgs e)
        {
            // Get time from TimePicker
            TimeSpan ts  = editTimePickerCell.Time;
            DateTime now = System.DateTime.Now;

            AlarmModel.BindableAlarmRecord.ScheduledDateTime = new System.DateTime(now.Year, now.Month, now.Day, ts.Hours, ts.Minutes, 0);
            // Get name from Entry
            AlarmModel.BindableAlarmRecord.AlarmName         = ((AlarmEditName)nameCell.View).mainEntry.Text;
            AlarmModel.BindableAlarmRecord.WeekdayRepeatText = AlarmModel.BindableAlarmRecord.GetFormatted(AlarmModel.BindableAlarmRecord.WeekFlag, AlarmModel.BindableAlarmRecord.AlarmState < AlarmStates.Inactive ? true : false);

            DependencyService.Get <ILog>().Debug("*** [START] [Clicked_SaveAlarm] BindableAlarmRecord : " + AlarmModel.BindableAlarmRecord);
            AlarmModel.BindableAlarmRecord.PrintProperty();

            AlarmRecord duplicate      = new AlarmRecord();
            bool        existSameAlarm = CheckAlarmExist(ref duplicate);

            if (existSameAlarm)
            {
                DependencyService.Get <ILog>().Debug("[Clicked_SaveAlarm] SAME ALARM EXISTS!!!!  duplicate : " + duplicate);
                duplicate.PrintProperty();

                // Need to show information
                Toast.DisplayText("Alarm already set for " + AlarmModel.BindableAlarmRecord.ScheduledDateTime + " " + AlarmModel.BindableAlarmRecord.AlarmName + ".\r\n Existing alarm updated.");

                // Use alarm created date for unique identifier for an alarm record
                string alarmUID = AlarmModel.BindableAlarmRecord.GetUniqueIdentifier();

                if (!AlarmModel.BindableAlarmRecord.IsSerialized)
                {
                    // in case that AlarmEditPage is shown by clicking a FloatingButton
                    // when trying to create a system alarm and save it, find the same alarm
                    // expected behavior : update the previous one and do not create a new alarm
                    DependencyService.Get <ILog>().Debug("  case 1:   A new alarm will be not created. The existing alarm(duplicate) will be updated with new info.");
                    AlarmModel.BindableAlarmRecord.IsSerialized = true;
                    // Copy modified data to the existing alarm record except alarm UID & native UID
                    duplicate.DeepCopy(AlarmModel.BindableAlarmRecord, false);
                    // Update the existing alarm(duplicate)
                    AlarmModel.UpdateAlarm(duplicate);
                }
                else if (alarmUID.Equals(duplicate.GetUniqueIdentifier()))
                {
                    // in case that AlarmEditPage is shown by selecting an item of ListView in AlarmListPage
                    // At saving time, just update itself. (It doesn't affect other alarms)
                    DependencyService.Get <ILog>().Debug("  case 2:   duplicate == AlarmModel.BindableAlarmRecord. So, just update BindableAlarmRecord.");
                    AlarmModel.UpdateAlarm(AlarmModel.BindableAlarmRecord);
                }
                else
                {
                    // in case that AlarmEditPage is shown by selecting an item of ListView in AlarmListPage
                    // At saving time, the same alarm is found.
                    // In case that this alarm is not new, the existing alarm(duplicate) will be deleted and it will be updated.
                    DependencyService.Get <ILog>().Debug("  case 3:   delete duplicate and then update BindableAlarmRecord.");
                    // 1. delete duplicate alarm
                    AlarmModel.DeleteAlarm(duplicate);
                    // 2. update bindableAlarmRecord
                    AlarmModel.UpdateAlarm(AlarmModel.BindableAlarmRecord);
                }
            }
            else
            {
                DependencyService.Get <ILog>().Debug("NO SAME ALARM EXISTS!!!!");
                if (!AlarmModel.BindableAlarmRecord.IsSerialized)
                {
                    // In case that AlarmEditPage is shown by clicking FloatingButton
                    // There's no same alarm. So, just create a new alarm and add to list and dictionary.
                    DependencyService.Get <ILog>().Debug("  case 4:   just create an alarm");
                    AlarmModel.BindableAlarmRecord.IsSerialized = true;
                    AlarmModel.CreateAlarmAndSave();
                }
                else
                {
                    // in case that AlarmEditPage is shown by selecting an item of ListView in AlarmListPage
                    // There's no same alarm. So, just update itself.
                    DependencyService.Get <ILog>().Debug("  case 5:   just update itself");
                    AlarmModel.UpdateAlarm(AlarmModel.BindableAlarmRecord);
                }
            }

            AlarmModel.PrintAll("Move from AlarmEditPage to AlarmListPage");
            ((App)Application.Current).floatingButton.Show();
            Navigation.PopAsync();
        }