Moving logic to detect activeAccount to factory.