Improve profile saving logic to handle id_member and initial creations