How to Calculate UV Map and Tangents for Unity Mesh

I have an editor script that removes all the vertices of a specific color, however, when I delete these it messes up my UV Map, and therefore the tangents which cause a mess of problems with the model. Is there a way to (re)-calculate the UV map and tangents, thereby fixing the problems with the mesh? Or is there a better way to solve this?

The following forum thread includes a good method for recalculating the tangents of a mesh. I used this in a project and it worked wonderfully:

http://forum.unity3d.com/threads/38984-How-to-Calculate-Mesh-Tangents

Note: I converted this to C#