protected void ButtonInsert_Click(object sender, EventArgs e)
        {
            // Create instance of task and insert it in table Tasks

            // Get values from user
            if (Page.IsValid)
            {
                var title = TextBoxTitle.Text;
                var content = TextBoxContent.Text;
                var priority = DropdownListPriority.SelectedValue;
                var state = DropdownListState.SelectedValue;
                int? type = null;
                if (DropdownListType.Text != string.Empty)
                {
                    type = int.Parse(DropdownListType.Text);
                }

                var dateAsString = TextBoxCalendar.Text;
                var inputTime = TextBoxTime.Text.Split(new char[] { ' ', ':' }, StringSplitOptions.RemoveEmptyEntries);
                StringBuilder time = new StringBuilder();
                time.Append(inputTime[0] + ':');
                time.Append(inputTime[1]);
                time.Append(' ' + inputTime[2]);
                dateAsString += ' ' + time.ToString();
                var date = DateTime.ParseExact(dateAsString, "MM/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture);

                var location = string.Empty;
                if (TextBoxLocation.Text == String.Empty)
                {
                    location = null;
                }
                else
                {
                    location = TextBoxLocation.Text;
                }

                var noteText = TextBoxNote.Text;

                using (context)
                {
                    var task = new Task
                    {
                        Task_Title = title,
                        Task_Content = content,
                        Priority_ID = priority,
                        State_ID = int.Parse(state),
                        Type_ID = type,
                        Author_ID = AuthorId,
                        Creation_Date = DateTime.Now,
                        Date_Day = date,
                        Date_Time = date,
                        Location_Name = location,
                        Data_id = null
                    };

                    context.Tasks.Add(task);

                    if (noteText != "")
                    {
                        //var insertedTask = context.Tasks.Find(task);
                        var note = new Note
                        {
                            Note_Content = noteText,
                            Task_ID = task.Task_Id
                        };

                        context.Notes.Add(note);
                    }

                    context.SaveChanges();
                }

                LabelValidity.Text = "Task has been successfully added!";
            }
            else
            {
                LabelValidity.Text = "Task is invalid";
            }
        }
        protected void ButtonInsert_Click(object sender, EventArgs e)
        {
            // Create instance of task and insert it in table Tasks

            // Get values from user
            if (Page.IsValid)
            {
                var title    = TextBoxTitle.Text;
                var content  = TextBoxContent.Text;
                var priority = DropdownListPriority.SelectedValue;
                var state    = DropdownListState.SelectedValue;
                int?type     = null;
                if (DropdownListType.Text != string.Empty)
                {
                    type = int.Parse(DropdownListType.Text);
                }


                var           dateAsString = TextBoxCalendar.Text;
                var           inputTime    = TextBoxTime.Text.Split(new char[] { ' ', ':' }, StringSplitOptions.RemoveEmptyEntries);
                StringBuilder time         = new StringBuilder();
                time.Append(inputTime[0] + ':');
                time.Append(inputTime[1]);
                time.Append(' ' + inputTime[2]);
                dateAsString += ' ' + time.ToString();
                var date = DateTime.ParseExact(dateAsString, "MM/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture);

                var location = string.Empty;
                if (TextBoxLocation.Text == String.Empty)
                {
                    location = null;
                }
                else
                {
                    location = TextBoxLocation.Text;
                }

                var noteText = TextBoxNote.Text;

                using (context)
                {
                    var task = new Task
                    {
                        Task_Title    = title,
                        Task_Content  = content,
                        Priority_ID   = priority,
                        State_ID      = int.Parse(state),
                        Type_ID       = type,
                        Author_ID     = AuthorId,
                        Creation_Date = DateTime.Now,
                        Date_Day      = date,
                        Date_Time     = date,
                        Location_Name = location,
                        Data_id       = null
                    };

                    context.Tasks.Add(task);

                    if (noteText != "")
                    {
                        //var insertedTask = context.Tasks.Find(task);
                        var note = new Note
                        {
                            Note_Content = noteText,
                            Task_ID      = task.Task_Id
                        };

                        context.Notes.Add(note);
                    }

                    context.SaveChanges();
                }

                LabelValidity.Text = "Task has been successfully added!";
            }
            else
            {
                LabelValidity.Text = "Task is invalid";
            }
        }