Dynamics of entanglement in the transverse Ising model