Async attachment updating.

Async attachment updating. This majorly improves login performance, our server went from 2TPS to 20. I know the formating's off from your standards, sorry about that. Tested and working with the SQL back end.  Not tested with file backend as we do not use it. You may want to change some parts of it, but it would relay help if you pulled this.