The class <code>CDIBasedContainer</code> has some very similar code... maybe we can do some convergence?