/**
  * This function takes care of the post method in Add Task Template page.
  *
  * @param string        POST Data
  *
  * @return  if validation error -> same page with error message | if db error -> Task Template page with error message  | no errors -> Task Template page with success message
  */
 public function TaskTemplateEditPost()
 {
     $input = Request::all();
     //create arrays to store post data
     $iTodoList = array();
     $iDescription = array();
     //take inputs to variables
     $iName = $input['iEventName'];
     //delete exsisting task_template data
     Task_Templates::where('EventName', $iName)->delete();
     //store input data in corresponding arrays
     foreach ($input['Task'] as $x) {
         $iTodoList[] = $x;
     }
     foreach ($input['Description'] as $y) {
         $iDescription[] = $y;
     }
     //input data to task_templates table
     try {
         foreach ($input['Task'] as $z => $value) {
             echo $iTodoList[$z] . ' ' . $iDescription[$z];
             Task_Templates::insert([['EventName' => $iName, 'ToDoTask' => $iTodoList[$z], 'Description' => $iDescription[$z]]]);
         }
     } catch (\Illuminate\Database\QueryException $e) {
         return redirect('dashboard/events/categories/tasks')->with('message', 'Record Update Failed ' . $e->getCode());
     }
     return redirect('dashboard/events/categories/tasks')->with('message', 'Record Updated Successfully ');
 }