Quick version of the question. Let $(X, \mu)$ be a probability measure space and let $Z$, the group of integers, act on $X$ in a measure preserving way. How can I decompose $X$ into ergodic componenets? More precisely, can $X$ be equivariantly decomposed into a countable union of subspaces $U_i$, each of which is isomorphic to a product $A_i\times B_i$, such that action on $U_i$ is a product of an ergodic action on $A_i$ and the trivial action on $B_i$?

One can ask the same question also for groups other than integers.

# My motivation

I'm currently learning basics of ergodic theory. More precisely, I'm interested in the notion of *cost*. Let me recall it for group actions: Let a countable discrete group $G$ act on a probability measure space $(X,\mu)$ in a free and probability measure preserving (pmp) manner. Call the action $\rho$. Let $\mathcal R(\rho)$ be the equivalence realtion on $X$ given by $\rho$ (i.e. two points of $X$ are equivalent iff there's a group element which sends one point to the other). Let $F=(U_i,g_i)_{i=1}^\infty$ be a countable family of pairs, where each $U_i$ is a measurable set, and each $g_i$ is an element of $G$. Let $\mathcal R(F)$ be the equivalence relation on $X$ generated by the relation $x \sim y$ iff for some $i$ we have $x\in U_i$ and $\rho(g_i)(x)=y$. Define
$$
cost(F) = \sum \mu(U_i),
$$
and let cost of the action $\rho$ be the infimum of numbers $cost(F)$ over all families $F$ such that $\mathcal R(F) = \mathcal R(\rho)$, perhaps after restricting both relations to subsets of measure $1$.

Theorem.Let $\rho$ be a free pmp action of $\mathbb Z \times H$, where $H$ is any countable group. Then $cost(\rho)=1$

Suppose first that restriction of the action $\rho$ to $\mathbb Z$ is ergodic. Fix $\varepsilon$. Then for the family $F$ choose pairs $(X, t), (A_1, h_1), (A_2,h_2) \ldots $, where $t$ is a generator of $\mathbb Z$, $h_i$ is an enumeration of elements of $H$, and $A_i$ is any set such that $\mu(A_i)= \frac{\varepsilon}{2^i}$.

Clearly $cost(F) \le 1 + \varepsilon$, so it's enough to see that $\mathcal R(F) = \mathcal R(\rho)$. Take a point $x$ of $X$ and fix $h_i\in H$. We're gonna show that, with probability $1$, $x$ is in relation with $\rho(h_i)(x)$. By the ergodic theorem, since we assume action of $\mathbb Z$ is ergodic, with probability $1$ for some $j$ we have $\rho(t^j)(x)\in A_i$, so we have $x \sim \rho(t^j)(x) \sim \rho(h_it^j)(x) \sim \rho(h_i)(x)$.

When I heard the argument it wasn't even mentioned that we assume that restricion to $\mathbb Z$ is ergodic. Intuitively it's clear what to do - choose $A_i$ more cleverly, "perpendicular to ergodic components of $\mathbb Z$".

Question. Which theorem from ergodic theory allows to make this choice of $A_i$ "perpendicular to ergodic components" precise?