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 $\displaystyle \lambda$. The number of hours to complete each job, $\displaystyle Y_{i}$, is gamma distributed with parameters $\displaystyle \alpha$ and $\displaystyle \beta$. The total time to complete all jobs in a week is: $\displaystyle T = \sum_{i=1}^{N}{Y_i}$

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

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

a)

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

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

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

$\displaystyle \sum_{i=1}^{n} E(Y_i)$

and because $\displaystyle Y_i$ is gamma distributed =>

$\displaystyle

E(Y_i) = \alpha \beta $

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

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

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

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

The correct answer is $\displaystyle = \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.