public static Task CreateNewTask(string info) { //Validate input if (info == "") { MessageBox.Show("Task cannot be empty.", "Task Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } else if (info.Length > 250) { MessageBox.Show("Task cannot be more than 250 characters. Please shorten the task.", "Task Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } //Add new item to the list return(new Task(Task.CreateId(), info, false)); }