     |> Repo.preload(:question_tags)
 
     changeset = Question.changeset(
-      Map.merge(question, %{tags: question.question_tags}),
+      Map.merge(question, %{answer: question.question_tags}),
       question_params)
 
-    case Repo.update(changeset) do
+    case update_question_and_tags(changeset) do
       {:ok, question} ->
-        question = question
-        |> Repo.preload(:question_tags)
+        answer = Repo.all(from(qt in QuestionTag, where: qt.question_id == ^question.id))
+        question = Map.merge(question, %{answer: answer})
 
-        render(conn, "show.json", question: question)
+        render(conn, "show.json", %{question: question})
       {:error, changeset} ->
         conn
         |> put_status(:unprocessable_entity)


    case insert_question_and_tags(changeset) do
      {:ok, question} ->
        question = question
        |> Repo.preload(:question_tags)

        conn
        |> put_status(:created)
        |> put_resp_header("location", question_path(conn, :show, question))
        |> render("show.json", question: question)

      {:error, changeset} ->
        conn

    end)
  end

  defp update_question_and_tags(changeset) do
    Repo.transaction(fn ->
      case (Repo.update(changeset) |> remove_tags(changeset) |> insert_tags(changeset)) do
        {:error, changeset} ->
          Repo.rollback(changeset)
        {:ok, question, tags} ->
          Map.merge(question, %{tags: tags})
      end
    end)
  end

  defp insert_tags({:error, changeset}, _), do: {:error, changeset}
  defp insert_tags({:ok, question}, changeset) do
    tag_id_to_changeset = fn answer ->
      QuestionTag.changeset(%QuestionTag{}, %{"tag_id" => answer["tag"],
                                              "required" => answer["required"],
                                              "question_id" => question.id})
    end

    insert_changeset = fn
