     IO.inspect(HTTPotion.post(hook, bodify(%{event: event, edits: edits})))
   end
 
+  def exec("duplicate", %{event: event}) do
+    spawn(fn ->
+      case Cosmic.get(@cosmic_config_slug) do
+        %{"metadata" => %{"event_duplicated" => hook}} ->
+          IO.puts("Posting webhook to #{hook} because of edit")
+          IO.inspect(HTTPotion.post(hook, bodify(%{event: event})))
+
+        _ ->
+          nil
+      end
+    end)
+  end
+
   def exec("message_host", contents = ~m(event host message)a) do
     if @instance != "jd" do
       %{"metadata" => %{"message_host" => hook}} = Cosmic.get(@cosmic_config_slug)


  defp bodify(body), do: [body: Poison.encode!(IO.inspect(body))]

  defp process_event(event) do
    event
    |> Map.put(:date_line, get_date_line(event))
  end

  def get_date_line(event) do
    humanize_date(event.start_date) <>
      "from " <> humanize_time(event.start_date) <> " - " <> humanize_time(event.end_date)
  end

  defp humanize_date(dt) do

    "#{hour}#{minute} " <> am_pm
  end

  def parse(dt, _offset \\ 0) do
    case DateTime.from_iso8601(dt) do
      {:ok, result, _} ->
        result

      _ ->
        case DateTime.from_iso8601(dt <> "Z") do
          {:ok, result, _} -> result
          _ -> Timex.now()
        end
    end
  end

  def zero_pad(int) do
    str = "#{int}"
    if String.length(str), do: str, else: "0#{str}"
  end

  def flatten(%{} = map) do
