I'm having some trouble with hierarchical models.

Suppose that a company has determined that the number of jobs per week, N, varies from week to week and has a Poisson distribution with mean \lambda. The number of hours to complete each job, Y_{i}, is gamma distributed with parameters \alpha and \beta. The total time to complete all jobs in a week is: T = \sum_{i=1}^{N}{Y_i}

Note that T is the sum of a random number of random variables.

What is E(T\mid N=n)?

The correct answer is n\alpha\beta, but I don't know how to get there? Is it correct to do like this?

E(T\mid N=n) = E( \sum_{i=1}^{N}{Y_i}\mid N=n) =
\sum_{i=1}^{N}E(Y_i\mid N=n) =
\sum_{i=1}^{n} E(Y_i)

and because Y_i is gamma distributed =>
<br />
E(Y_i) = \alpha \beta

\sum_{i=1}^{n}{\alpha \beta } = n\alpha \beta

b) E(T) = E(\sum_{i=1}^{N}{Y_i}) =

\sum_{i=1}^{N} E(Y_i)

= \sum_{i=1}^{N} \alpha \beta

The correct answer is = \lambda \alpha \beta , but I don't know how to get there. I don't really know how to think when it comes to hierarchical models. It's kind of difficult, I think. Thanks in advance for your help.