Should removeIndex method be called out of if statement? This way, if there is no defined store you can't remove indexes?