functionality for updating and entity and sending emails