Performing a Legendre Transform for a magnetic system

I got this exam question that stated:

For a magnetic system, conservation of energy is expressed by the relation $dU = TdS - MdB$ where $U(S,B)$ is energy, $T$ is temperature, $S$ is entropy, $M$ is magnetization, and $B$ is magnetic field. Perform a Legendre transformation to construct a new function $F(T,B)$ and write a differential expression for $dF$ in terms of the other our variables.

What I ended up doing was declaring some function \begin{align} F(TS) = TdS + SdT \end{align} and then \begin{align} F(TS) - dU = SdT + MdB = dg \end{align} and therefore \begin{align} dg = SdT + MdB. \end{align} However, I only got 5/7. What didn't I do that made this wrong?

The application of the Legendre-Transformation to $U(S,B)$ for the substitution of $S$ by $T$ is \begin{align*} F(T,B) = ST - U(S,B). \end{align*} with the total differential \begin{align*} dF &= S\,dT + T\,dS - \underbrace{(T\,dS - M\,dB)}_{=dU} = S\, dT + M\, dB. \end{align*}