public bool RemoveNotification(Notification notification)
        {
            Notification tempNotification = Conn.GetSingleItem <Notification>("SELECT * FROM Notification WHERE Id = ?", notification.Id);

            try
            {
                if (tempNotification == null)
                {
                    throw new Exception("ERROR_ALARM_DOESNT_EXIST");
                }

                if (tempNotification.Primary)
                {
                    throw new Exception("ERROR_PRIMARY_ALARM_DELETE");
                }

                ToastService.RemoveToastFromSchedule(notification);
                Conn.Delete(notification);
            }
            catch (Exception ex)
            {
                ErrorMessage = ErrorHandler.ReturnErrorMessage(ex.Message);
                return(false);
            }
            return(true);
        }
        public bool UpdateNotification(Notification notification, bool lastCheckIn = false)
        {
            Notification tempNotification = Conn.GetSingleItem <Notification>("SELECT * FROM Notification WHERE Id = ?", notification.Id);

            try
            {
                if (tempNotification == null)
                {
                    throw new Exception("ERROR_ALARM_DOESNT_EXIST");
                }

                if (String.IsNullOrEmpty(notification.Text) && !notification.Primary)
                {
                    throw new Exception("ERROR_FILL_ALL_FIELDS");
                }

                if (lastCheckIn && notification.TriggerTime > DateTime.Now)
                {
                    throw new Exception("ERROR_PAST_TIME");
                }

                if (!lastCheckIn && notification.TriggerTime < DateTime.Now)
                {
                    throw new Exception("ERROR_FUTURE_TIME");
                }

                if (!TimeCheck(notification.TriggerTime, lastCheckIn))
                {
                    throw new Exception("ERROR_TIME_INCORRECT");
                }

                if (lastCheckIn)
                {
                    notification.TriggerTime = NewTime;
                }

                ToastService.RemoveToastFromSchedule(notification);
                ToastService.SetToastForNotification(notification);
                Conn.Update(notification);

                if (notification.Primary)
                {
                    SetPrimaryNotification();
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ErrorHandler.ReturnErrorMessage(ex.Message);
                return(false);
            }
            return(true);
        }