Added API checks to ensure user exists and email is unique