Changed user save function to perform upsert rather than insert