   end
 
   def handle_call({:delete_all}, _from, {db, server_name, torrents}) do
-    ids = Map.keys(torrents)
-    status_table = Enum.reduce(ids, %{}, fn key, id ->
-
-    end)
-    torrents = Map.drop(torrents, Map.keys(torrents))
-    {:reply, {:ok, torrents}, {db, server_name, torrents}}
+    status_table =
+      Enum.reduce(Map.keys(torrents), %{}, fn key, acc ->
+        {status, _data} = TorrentSupervisor.terminate_child(key)
+
+        case status do
+          :error ->
+            JDLogger.error(@logger, "Could not kill #{key}")
+            acc
+
+          _ ->
+            Map.put(acc, key, status)
+        end
+      end)
+
+    torrents = Map.drop(torrents, Map.keys(status_table))
+
+    case torrents do
+      %{} ->
+        {:reply, {:ok, torrents}, {db, server_name, torrents}}
+
+      _ ->
+        {:reply, {:error, torrents}, {db, server_name, torrents}}
+    end
   end
 
   def handle_call({:start_torrent, id}, _from, {db, server_name, torrents}) do


        _ ->
          torrents = Map.delete(torrents, id)
          {:reply, {:ok, {200, id}}, {db, server_name, torrents}}
      end
    else
      JDLogger.debug(@logger, "Bad ID was given to delete")

      {:delete_all}
    )
  end
end
