       end
     end
   end
+
+
+  defp resource_name(defn) do
+    defn.resource_model |> base_name |> String.downcase |> String.to_atom
+  end
+
   defp send_resp(conn, default_status, default_content_type, body) do
     conn
     |> ensure_resp_content_type(default_content_type)

  def create(conn, defn, params) do
    model = defn.__struct__
    resource = conn.assigns.resource
    resource_model = defn.resource_model |> base_name |> String.downcase |> String.to_atom
    changeset_fn = Keyword.get(defn.changesets, :create, &resource.__struct__.changeset/2)
    changeset = ExAdmin.Repo.changeset(changeset_fn, resource, params[resource_model])

    case ExAdmin.Repo.insert(changeset) do
      {:error, changeset} ->

  @moduledoc false
  use ExAdmin.Web, :controller
  require Logger
  import ExAdmin.Utils
  import ExAdmin.ParamsToAtoms
  require IEx
