public function getTodos($userId, $projectId = null)
 {
     $this->userId = $userId;
     if ($projectId == null) {
         $todos = $this->todo->owner($userId)->withProject()->withPriority()->withGroup()->get();
     } else {
         $todos = $this->todo->owner($userId)->byProject($projectId)->withProject()->withPriority()->withGroup()->get();
     }
     $projects = Project::whereHas('users', function ($q) {
         $q->where('user_id', '=', $this->userId);
     })->active()->lists('name', 'id');
     $data = array('todos' => $todos, 'projects' => $projects);
     return Response::JSON($data);
 }