Refactor and test TodoService.