Let $X$ be a random variable on a probability space $(\Omega, \mathcal A, P)$ such that $E|X|<\infty$. Suppose $\mathcal G \subset \mathcal A$ is a sub-$\sigma$-algebra with intersection-stable generator $\mathcal M$ such that $\Omega \in \mathcal M$. Let $Y\in L^1(\Omega, \mathcal G, P)$. Then $$\int_AX dP =\int_AY dP$$ for every $A\in \mathcal M$ implies that the above equality holds for every $A \in \mathcal G$.
How do I approach this problem? The first thing that jumps to mind whenever we have an intersection-stable generator is that its generated Dynkin-system coincides with its generated $\sigma$-algebra. Does this imply that we can write $A\in \mathcal G$ as the disjoint union of sets that lie in $\mathcal M$ or whose complement lies in $\mathcal M$?
I'm thankful for any help.