   @doc "Builds a list of supervisor children. Will also delete and not build a child from stale data."
   @spec build_children([%PersistentRegimen{}]) :: Supervisor.child_spec()
   def build_children(prs) do
-    Enum.reject(prs, fn(%{regimen_id: rid, farm_event_id: feid}) ->
+    Enum.reject(prs, fn(%PersistentRegimen{regimen_id: rid, farm_event_id: feid}) ->
       reg = Asset.get_regimen_by_id(rid, feid)
       if Asset.get_farm_event_by_id(feid) && reg do
         _rejected = false

        _rejected = true
      end
    end)
    |> Enum.map(fn(%{regimen_id: id, time: time, farm_event_id: feid}) ->
      regimen = Asset.get_regimen_by_id!(id, feid)
      args = [regimen, time]
      opts = [restart: :transient, id: feid]

  def stop_all_managers(regimen) do
    Logger.info 3, "Stopping all running regimens by id: #{inspect regimen.id}"
    prs = ConfigStorage.persistent_regimens(regimen)
    for %PersistentRegimen{farm_event_id: feid} <- prs do
      reg_with_fe_id = %{regimen | farm_event_id: feid}
      name = NameProvider.via(reg_with_fe_id)
      case GenServer.whereis(name) do
