                                                value: value,
                                                source: source})
     Repo.insert(changeset)
-  end
-
-  def enrich(email, user, session_id) do
-    fullcontact_data = fetch_fullcontact_json(email.value)
-                       |> Poison.decode!
-
-    if fullcontact_data["likelihood"] > 0.91 do
-      add_avatar(user, session_id, fullcontact_data)
-      add_websites(user, session_id, fullcontact_data)
-      add_social_media_accounts(user, session_id, fullcontact_data)
-      add_work_experiences(user, session_id, fullcontact_data)
-      add_tags(user, session_id, fullcontact_data)
-      add_address(user, session_id, email, fullcontact_data)
-    end
   end
 
   def fetch_fullcontact_json(email_address) do

  alias Vutuv.Email
  alias Vutuv.DataEnrichment

  def enrich(user) do
    # create a new session ID
    query = from d in DataEnrichment, where: d.user_id == ^user.id,
                                      order_by: :session_id,
                                      limit: 1
    last_data_enrichment = Repo.one(query)

    session_id =
      if last_data_enrichment do
        last_data_enrichment.session_id + 1
      else
        1
      end

    query = from e in Email, where: e.user_id == ^user.id
    emails = Repo.all(query)
    for email <- emails do
      enrich(email, user, session_id)
    end
  end

  def within_api_limits?() do

    end
  end

  defp add_avatar(user, session_id) do
    if enrichable_avatar(user) do
      avatar_url = enrichable_avatar(user)
      download_and_store_avatar(user, avatar_url)
      store_data_enrichment(user, session_id, "Added avatar photo", avatar_url)
    end

    # unless user.avatar do
    #   if List.first(fullcontact_data["photos"]) do
    #     avatar_url = List.first(fullcontact_data["photos"])["url"]
    #     download_and_store_avatar(user, avatar_url)
    #     store_data_enrichment(user, session_id, "Added avatar photo", avatar_url)
    #   end
    # end
  end

  defp download_and_store_avatar(user, url) do
