Yes you are right, he was an advisor to Stalin, from the early 20's.
For some strange reason Stalin was interested in restoring historical wooden buildings, and relied on Prince Baranovsky's advice and knowledge of Russian architecture to assist him. How Prince Peter Baranovsky survived Stalin I dont quite know. But I think that certain family members were leftist radicals before the revolution, so perhaps that saved his bacon.
Prince Baranovsky ( Originally Tugan-Baranovsky) came from an old Ukrainian family. The family came to prominenece in the the 17th century when they raised an army and defeated the Chinese hordes.
He was responsible mainly for the restoration of Kolomenskoye, a favourite summer retreat of Tsar Michael Fedorovich Romanov. In 1936, on orders from Stalin, he had the wooden house of Peter I brought from Arkhangelsk to Kolomenskoye, where it was reconstructed. It forms part of the museum today.
One can also see other wooden buildings which were reconstructed by the Prince in 1927 at Kolomenskoye, amongst these is a brewery building previously at the Tsars estate at Preobrazhenskoye.
It is surprising that Stalin saved these buildings and had them restored, considering the blatant disregard he had for many other beautiful buildings and palaces.
Prince Baranovsky was also responsible for the restorations carried out on the original Kazan Cathedral on Red Square between 1929 - 1932.
The Cathedral was later destroyed, when Stalin ordered the Red Square cleared of churches, to make way for his military parades.
The cathedral was rebuilt in the 1990's and reopened in 1993.
Prince Baranovsky saved the Church of Intercession from destruction in the Kremlin, by refusing to obey the orders of Stalin to demolish it. He sent a very brazen telegram to Stalin, threatening to cut his own throat on the steps of the Cathedral if it was demolished.
For some strange reason Stalin relented, and the building was saved.
Baranovsky's reward was 5 years in a labour camp.