When they gathered the young women to the second women's house, Mordecai was working for the king at the King's Gate.
References for Esther 2:19
Esther still wasn't telling anyone her family background and race, just as Mordecai had ordered her. She continued to do what Mordecai said, just as she did when she was in his care.
At that time, as Mordecai continued to work at the King's Gate, two royal eunuchs, Bigthan and Teresh, became angry with King Ahasuerus. They were among the guards protecting the doorway to the king, but they secretly planned to kill him.
References for Esther 2:21
When Mordecai got wind of it, he reported it to Queen Esther. She spoke to the king about it, saying the information came from Mordecai.
The matter was investigated and found to be true, so the two men were impaled on pointed poles. A report about the event was written in the royal record with the king present.
References for Esther 2:23