Let $X$ and $A$ be compact Polish spaces endowed with Borel $\sigma$-algebras $\mathcal{X}$ and $\mathcal{A}$, respectively, and let $u: X\times A\rightarrow\mathbb{R}$ be a continuous function. Let $\pi\in \Delta(X\times A)$ be a probability measure.

Let $\mathcal{F}\equiv \{f:A\rightarrow A|\;f \text{ is } \mathcal{A} \text{ measurable}\}$ denote the collection of all measurable functions from $A$ to $A$.

**Question:** Is it true that
$$\sup_{f\in \mathcal{F}}\int_{X\times A} E \big[u\big(x,f(a)\big) \big| \mathcal{A}\big] d\pi(x,a) = \int_{X\times A}\; \sup_{f\in \mathcal{F}}E \big[u\big(x,f(a)\big) \big| \mathcal{A}\big] d\pi(x,a)?$$


-----------
----
**My thoughts so far:**

My first instinct is to invoke the Measurable Selection Theorem, which would be similar to the arguments in Theorem 14.60 of Rockafella and Wets' "Variational Analysis". However, I do not know how to work with the conditional expectations in the expression above, which is itself a random variable that is only unique almost surely.

Specifically, to use the Measurable Selection Theorem as Rockafellar and Wets did, I would need to somehow establish that
$$
\Big\{k: E \big[u\big(x,k\big) \big| a\big] \ge c \Big\}
$$
is a closed set for each $a\in A$ and $c\in \mathbb{R}$, but I'm not sure why that would be true, especially since conditional expectation is only pinned down for **almost all** $a\in A$.

Any pointers would be greatly appreciated!