Despite living on the Upper East Side in Gracie Mansion, New York City Mayor Bill de Blasio will cast his ballot for the Democratic primary this morning in Park Slope, the Brooklyn neighborhood where he lived for more than 20 years and where he still prefers to spend his time. But the mayor himself apparently had to deal with some bureaucratic mishaps to keep it that way.

RELATED: Five things to watch in New York's 2017 primary elections

According to de Blasio’s voter record at the New York City Board of Elections, his address was changed on May 30, 2015, from his 11th Street Brooklyn home to Gracie Mansion in Manhattan because of a change filed with the U.S. Postal Service. Weeks later, on July 14, his registration was changed back to Brooklyn, per his request. A year after that, on June 7, 2016, de Blasio’s address on file was changed back again to Gracie Mansion.

This time, de Blasio’s lawyer, Henry Berger, wrote a letter to the Board of Elections explaining that, while the mayor, his wife and his son want to receive mail at Gracie Mansion, they are residing there “temporarily only during his term of office,” and intend to return to their “permanent domicile” in Park Slope. The letter seemed to work, and de Blasio’s address on file reverted back to Park Slope, where he plans to vote today as a legal, permanent resident of Brooklyn.