During the early months of World War I, Kars was a key military objective for the Ottoman army. Ismail Enver who pushed the Ottoman Empire into World War I, needed a victory against the Russians to defend his position. He collected an army on the eastern border. The army was badly defeated under Enver's command at the Battle of Sarikamish January 2, 1915 against Nikolai Nikolaevich Yudenich. This defeat was more due to the winter weather and bad planning, given the fact that Russians were actually preparing to evacuate Kars. With the loss of the eastern army, Ottoman defenses crumbled with further small battles and the Russian army succeeded in advancing as far west as Erzincan. The collapse of the Russian army after the 1917 revolution left only thinly spread Armenian units to resist the inevitable Ottoman counter-attack. Before the end of World War I in 1918, the Ottoman army reformed with what was left from the middle-east branch and tried to build a line between whatever seemed to be left on their east border. The newly declared First Republic of Armenia captured Kars in April 1918, which was eventually handed back by the future Soviet administration. That same year in March, the Baku Commune was established in the Azerbaijan Democratic Republic. The commune later became the Centrocaspian Dictatorship, in turn conquered by the Islamic Army of the Caucasus, then shortly by the Triple Entente and finally the Bolsheviks. Defeat on other fronts caused the Ottoman Empire to surrender and withdraw forces. Both the Armenian and Azerbaijani Republics ended up being part of the Soviet Union in 1920.. How many years after the revolution did the Armenian and Azerbaijani Republics end up being part of the Soviet Union?