Groups user lost after saving

When a user changes his profile, the groups data is lost because before saving the new data, the groups property is set to null.

I propose to save the groups property before saving and restore it after.