Even after all the young women had been transferred to the second harem and Mordecai had become a palace official,
References for Esther 2:19
Esther continued to keep her nationality and family background a secret. She was still following Mordecai's orders, just as she did when she was living in his home.
One day as Mordecai was on duty at the palace, two of the king's eunuchs, Bigthana and Teresh -- who were guards at the door of the king's private quarters -- became angry at King Xerxes and plotted to assassinate him.
References for Esther 2:21
But Mordecai heard about the plot and passed the information on to Queen Esther. She then told the king about it and gave Mordecai credit for the report.
When an investigation was made and Mordecai's story was found to be true, the two men were hanged on a gallows. This was all duly recorded in The Book of the History of King Xerxes' Reign.
References for Esther 2:23