how does magnetic separation work