Extract id generation into separate class