         :showtimes,
         mov.schedules
         |> map(fn showtime ->
-          %{title: mov.title, cinemahall: "cineplex", imdb_id: mov.imdb_id, showtime: showtime}
+          %{
+            title: mov.title,
+            cinemahall: "cineplex",
+            imdb_id: mov.imdb_id,
+            showtime: DateTime.from_naive!(showtime, "Etc/UTC")
+          }
         end)
       )
     end)
   end
 
-  def get_new_movies(movies) do
+  @spec get_saved_movies_with_injected_id([Movie.movie()]) :: [Movie.movie()]
+  defp get_saved_movies_with_injected_id(movies) do
+    movies
+    |> filter(&member?(get_saved_movie_titles(), &1.title))
+    |> map(&Map.put(&1, :id, Repo.get_by(Movie, title: &1.title).id))
+    |> map(
+      &Map.put(
+        &1,
+        :showtimes,
+        &1.showtimes |> map(fn showtime -> Map.put(showtime, :movie_id, &1.id) end)
+      )
+    )
+  end
+
+  @spec get_new_movies([Movie.movie()]) :: [Movie.movie()]
+  defp get_new_movies(movies) do
     movies
     |> filter(&(!member?(get_saved_movie_titles(), &1.title)))
   end
 
-  def get_new_showtimes(movies) do
-    saved_movies =
-      movies
-      |> filter(&member?(get_saved_movie_titles(), &1.title))
-
+  @spec get_new_showtimes([Movie.movie()]) :: [Movie.showtime()]
+  defp get_new_showtimes(movies) do
+    saved_movies = get_saved_movies_with_injected_id(movies)
     # list of showtimes from the provided movies
     fetched_showtimes = saved_movies |> map(fn m -> m.showtimes end) |> List.flatten()
     # fetch showtimes from db and checks if there are

    persist_showtimes(new_showtimes)
  end

  def merge_with_showtimes(movies) do
    movies
    |> map(fn mov ->
      Map.put(

    Repo.all(query)
  end

  @spec persist_new_movies([Movie.movie()]) :: [
          {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
        ]
  defp persist_new_movies(movies) do
    movies
    |> map(fn mov -> Movie.changeset(%Movie{}, mov) end)
    |> map(fn cset -> Repo.insert(cset) end)
  end

  @spec persist_showtimes([Movie.showtime()]) :: [
          {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
        ]
  defp persist_showtimes(showtimes) do
    showtimes
    |> map(&Showtime.changeset(%Showtime{}, &1))
    |> map(&Repo.insert(&1))
