 
       case Map.fetch(experiment_params, "participants_ids") do
         {:ok, participants_ids} ->
-          attach_participants_to_experiment(participants_ids, experiment)
+          add_participants_to_experiment(participants_ids, experiment)
       end
 
       conn

    end
  end

  defp attach_participants_to_experiment(participants_ids, experiment) do
    for participant_id <- participants_ids do
      has_participant = ExperimentsHasParticipants |> Repo.get_by(%{
        participant_id: participant_id,
        experiment_id: experiment.id
      })

      if is_nil(has_participant) do
        insert_participant_experiment(participant_id, experiment.id)
      end
    end
  end

  defp insert_participant_experiment(participant_id, experiment_id) do
    experiments_has_participants_changeset = ExperimentsHasParticipants.changeset(
      %ExperimentsHasParticipants{},
      %{"participant_id" => participant_id, "experiment_id" => experiment_id}
    )

    Repo.insert!(experiments_has_participants_changeset)
  end

  defp fetch_participants(experiment) do

  end

  def show(conn, %{"id" => id}) do
    experiment = Experiment |> Repo.get(id)

    case experiment do
      nil ->
