/// <summary>
        /// Method used for importing content from another site and an author for the content is required. The method first checks to see if any user
        /// with any of the external user's emails is already present on the site, and returns it if present, otherwise getting or creating and returning
        /// a default "anonymous" user to be used for the import.
        /// Note: this will print an error message to the console for every email tried that isn't present, this can be commented out in GetAbsolute in JiveClient
        /// </summary>
        /// <param name="extPerson">the Person object from the external site (usually the author of the external content)</param>
        /// <returns>a Person object that can be used as the author for the newly imported content</returns>
        public Person FindPerson(Person extPerson)
        {
            Person person = null;
            bool found = false;
            if (extPerson.emails != null)
            {
                foreach (var address in extPerson.emails)
                {
                    if (!found)
                    {
                        try
                        {
                            person = GetPersonByEmail(address.value);
                            found = true;
                        }
                        catch (HttpException)
                        {
                            found = false; //shouldn't be necessary, but just to make sure found isn't set to true when no user is found
                        }
                    }
                }
            }
            if (!found)
            {
                try
                {
                    person = GetPersonByUsername("*****@*****.**");
                }
                catch (HttpException)
                {
                    person = new Person();
                    person.emails = new List<ProfileEntry>();
                    person.emails.Add(new ProfileEntry());
                    person.emails[0].value = "*****@*****.**"; //use some dummy address here, Jive requires this field not be null
                    person.emails[0].jive_label = "Email";
                    person.emails[0].primary = true;
                    person.emails[0].type = "work";
                    person.jive = new JivePerson();
                    person.jive.username = "******";
                    person.jive.password = "******";
                    person.name = new Name();
                    person.name.familyName = "Guest";
                    person.name.givenName = "Anonymous";
                    person.type = "person";
                    person = CreatePerson(person);
                }
            }

            return person;
        }
        /// <summary>
        /// Create a Person object for a new user based on the contents of the specified Person. Only modifiable fields that actually provide a value
        /// in the incoming entity are processed.
        /// </summary>
        /// <param name="new_person">the Person object containing information describing the new user</param>
        /// <param name="welcome">Flag indicating that a welcome email should be sent to the newly created user</param>
        /// <param name="published">Date and time when this person was originally created. Only set this field when importing people.</param>
        /// <param name="fields">The fields to include in the returned entity</param>
        /// <returns>a Person object representing the created user</returns>
        public Person CreatePerson(Person new_person, bool welcome = false, DateTime? published = null, List<string> fields = null)
        {
            DateTime tmp;

            //construct the url for the HTTP request based on the user's specifications
            string url = peopleUrl;
            url += "?welcome=" + welcome.ToString();
            if (published != null)
            {
                tmp = (DateTime)published;
                url += "&published=" + jiveDateFormat(tmp);
            }
            if (fields != null && fields.Count > 0)
            {
                url += "&fields=";
                foreach (var field in fields)
                {
                    url += field + ",";
                }
                // remove last comma
                url = url.Remove(url.Length - 1);
            }

            string json = JsonConvert.SerializeObject(new_person, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore, Formatting = Formatting.Indented });
            string result;
            try
            {
                result = PostAbsolute(url, json);
            }
            catch (HttpException e)
            {
                switch (e.GetHttpCode())
                {
                    case 400:
                        throw new HttpException(e.WebEventCode, "Any of the input fields are malformed", e);
                    case 403:
                        throw new HttpException(e.WebEventCode, "Requesting user is not authorized to make changes to the specified user", e);
                    case 404:
                        throw new HttpException(e.WebEventCode, "Specified user does not exist", e);
                    case 409:
                        throw new HttpException(e.WebEventCode, "Requested change would cause business rules to be violated (such as more than one user with the same email address", e);
                    case 500:
                        throw new HttpException(e.WebEventCode, "Internal server error (e.g. username must be valid email address)", e);
                    case 501:
                        throw new HttpException(e.WebEventCode, "User creation is not supported in this Jive instance", e);
                    default:
                        throw;
                }
            }

            JObject Json = JObject.Parse(result);
            return Json.ToObject<Person>();
        }