Various Islamist groups have taken control over much of the country in recent months , leaving the government in charge of only Baidoa and parts of the capital , Mogadishu .