Three-dimensional modelling and inversion of controlled source electromagnetic data