Extract update_indices method to Task model