Get bean from GeneratedPropertyContainer

I have updated a Grid from using a BeanItemContainer to a GeneratedPropertyContainer to support Buttons in the Grid. This worked as advertised, very happy.

However some code that operated on Grid stopped working. The error I get is:

GeneratedPropertyItem cannot be cast to com.vaadin.data.util.BeanItem

The line of code in question is:

BeanItem beanItem = (BeanItem)getEditorFieldGroup().getItemDataSource();

I put the following of code in to inspect when debugging:

Item item = getEditorFieldGroup().getItemDataSource();

This shows that item contains the bean I am after.

How do I get a Bean out of item from a GeneratedPropertyContainer ?

Help much appreciated.