 
   defp create_view_count(article, view_count_data) do
     ViewCount.changeset(%ViewCount{}, %{article_id: article.id, count: view_count_data.count})
-    |> Repo.insert!()
+    |> Repo.insert()
   end
 
   defp get_article(path, team) do

defmodule EspiDni.ViewCountHandler do

  alias EspiDni.Repo
  alias EspiDni.ViewCount
  import EspiDni.Gettext


  def process_view_count(view_count_data, team) do
    article = get_article(view_count_data.path, team)

    case create_view_count(article, view_count_data) do
      {:ok, _} ->
        notify_if_count_spike(article)
      {:error, changeset} ->
        Logger.error "Cannot create view_count: #{inspect changeset}"
      _ ->
        nil
    end
  end

  defp notify_if_count_spike(article) do
    latest_counts = last_two_counts(article)

    if view_count_spike?(latest_counts) do
      send_spike_message(article,latest_counts)
    end
  end

