public function assignPeople(Request $request)
 {
     $user_roll = $request->input('user_roll');
     $task_id = $request->input('task_id');
     $assigned_list = $request->input('assigned_list');
     $assigned_ids = explode(',', $assigned_list);
     if (!CheckLevel::check(2, NULL, $user_roll)) {
         return JSONResponse::response(401);
     }
     $task = Task::where('task_id', '=', $task_id)->where('enabled', '=', true)->first();
     if ($task == NULL) {
         return JSONResponse::response(400);
     }
     $user_list = User::leftJoin('team_members', 'team_members.user_id', '=', 'users.user_id')->whereIn('users.user_roll', $assigned_ids)->where('team_members.team_id', '=', $task->team_id)->get();
     if (count($user_list) != count($assigned_ids)) {
         return JSONResponse::response(400);
     }
     // Remove existing assigned and overwrite it with the new list
     // Dev can know who are assigned with method getAssignedForTask
     //Delete the existing ones
     $success = Assigned::where('task_id', '=', $task_id)->delete();
     //Insert the new ones
     foreach ($user_list as $key => $user) {
         // echo "\ninserting".$task_id." ".$user->user_id;
         $a = new Assigned();
         $a->task_id = $task_id;
         $a->user_id = $user->user_id;
         $success = $a->save();
         // echo "\n".$success;
     }
     // Push Notification Code starts here
     $task_user_rolls = Assigned::where('task_id', '=', $task_id)->leftJoin('users', 'assigned.user_id', '=', 'users.user_id')->lists('user_roll');
     $push_message = Push::jsonEncode('newtask', $task);
     Push::sendMany($task_user_rolls, $push_message);
     // Push Notification Code ends here
     return JSONResponse::response(200, true);
 }