Refactor task repository to reuse index trait.