I'm solving this problem and I'm not sure how to solve it

I have definite triple integral of function f(x,y,z). It's domain is set $M = \{0<x<a; 0<y<a; 2y^2+xy-2ay-a^2 < z <2y^2+xy+ax-3ay\}$ where $a$ is real positive parameter.
The function f is quite simple and result of triple integration is finite. BUT (and here goes my question)

-> I would like to get function g(z) = \int\int f(x,y,z) dxdy but I'm quite confused with borders of integration (and od course domain of the function g)
-> Could you give me some help? Thanks in advance!


-> and here goes my idea (but I'm not sure about it):
- for each $z$ and $y$ I'm able to get an interval for $x$: $\max \left(0, \frac{z-2y^2+3ay}{y+a} \right) < x < \min \left( a , \frac{a^2 - 2y^2+2ay + z}{y} \right)$
- therefore I can get function \int_max(...)^min(...) f(x,y,z)dxdydz = [h]_{\max(...)}^{\min(...)}$
- for each $z$ I'm able to say which values functions min/max takes
- so the function g(z) could be sum of integrals of k(y,z) (the number of integrals and their domains depends on values of min/max function..)

-> so, is it good idea or really wrong way of thinking about this problem?
-> and what about domain of g(z)? (could it be [min_(x,y)f(x,y,z);max_(x,y)f(x,y,z)] ?)


Once again thanks in advance! (and sorry for my English.. ). Have a nice day!