Tensor partial differentiation question...

Hi I have the following tensor (the Cauchy-Green deformation tensor)

$\displaystyle C = \begin{bmatrix}

\lambda_{1}^2 & 0 & 0 \\

0 & \lambda_{2}^2 & 0 \\

0 & 0 & \lambda_{3}^2

\end{bmatrix}

$

and I have the following energy function

$\displaystyle W = D_{1}(I_{1}-3) + D_{2}(I_{2}-3) + f(\lambda)$

Where

$\displaystyle I_{1} = tr C = \lambda_{1}^2+\lambda_{2}^2+\lambda_{3}^2$

$\displaystyle I_{2} = {(tr C)^2 - tr C^2 = \lambda_{1}^2\lambda_{2}^2+\lambda_{2}^2\lambda_{3 }^2+\lambda_{3}^2\lambda_{1}^2$

$\displaystyle \lambda_{3} = \frac{1}{\lambda_{1}\lambda_{2}}$

$\displaystyle D_{1}$ and $\displaystyle D_{2}$ are constants

(And $\displaystyle f(\lambda)$ is a piecwise function who's derivitives are already known but I can supply this information if it is needed.)

How do I calculate $\displaystyle \frac{\partial W}{\partial C}$?

Some version of the chain rule?

Thanks for any help in this matter, Nic