protected function do_save( $term ) {

		if ( ! $term->term_id ) {
			$ids = wp_insert_term( wp_slash( $term->name ), $term->taxonomy, array(
				'description' => wp_slash( $term->description ),
				'parent'      => $term->parent,
				'slug'        => $term->slug
			) );
		} else {
			$ids = wp_update_term( $term->term_id, $term->taxonomy, array(
				'name'        => wp_slash( $term->name ),
				'description' => wp_slash( $term->description ),
				'parent'      => $term->parent,
				'slug'        => $term->slug
			) );
		}

		if ( is_wp_error( $ids ) ) {
			throw new \InvalidArgumentException( 'Error encountered while saving WP_Term: ' . $ids->get_error_message() );
		}

		$term = get_term( $ids['term_id'], $term->taxonomy );

		if ( is_wp_error( $term ) ) {
			throw new \UnexpectedValueException( $term->get_error_message() );
		}

		return $term;
	}