TotalTaxAmount SetTaxAmountByRow not working

SOLVED

Hi,

I am trying to update invoice's total tax  using below code

TaxSummaryInfo taxSummaryInfo = journal.GetTotalTaxAmountInfo();
if (taxSummaryInfo.GetCount() > 0)
{
double totalTax = 10;
taxSummaryInfo.SetTaxAmountByRow(1, totalTax);
taxSummaryInfo.Save();
}

But it's throwing error, field you are trying to update is not accessible.

Is there anything wrong or any suggestion to make it working?

Thanks in advance.