   def create(conn, fact_params) do
     changeset = Fact.changeset(%Fact{}, fact_params)
 
-    case Repo.insert(changeset) do
+    case insert_fact_and_annotations(changeset) do
       {:ok, fact} ->
         fact = fact
         |> Repo.preload(:question)
-        |> Repo.preload(:annotations)
+        |> Repo.preload(:fact_annotations)
 
         conn
         |> put_status(:created)

  defp insert_annotations({:error, changeset}, _), do: {:error, changeset}
  defp insert_annotations({:ok, fact}, changeset) do
    Ecto.Changeset.get_field(changeset, :annotations)
    |> Enum.map(create_changeset(fact_id))
    |> Enum.reduce(&insert_annotation/2)
  end

  defp remove_annotations({:error, changeset}, _), do: {:error, changeset}
  defp remove_annotations({:ok, fact}, changeset) do
    query = from(fa in FactAnnotation, where: fa.fact_id == ^fact.id)

    Repo.delete_all(query)

      case (Repo.update(changeset) |> remove_annotations(changeset) |> insert_annotations(changeset)) do
        {:error, changeset} ->
          Repo.rollback(changeset)
        {:ok, fact, annotations} ->
          fact
      end
    end)
