improved the comments.
added logic to retrieve the entity id on new.