how to get the recently added bean id in after save logic hooks?

I would like to retrieve the most recent id of an inserted data inside the after save method of logic hooks. How should I proceed with this? Thank you