public object Post([FromBody] Driver driver) { var validationErrors = _validator.ValidateForCreation(driver); if (validationErrors.Any()) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(new ErrorResponse { Errors = validationErrors.ToArray() }); } driver.Id = Guid.NewGuid().ToString(); driver.CreatedAt = DateTime.UtcNow; if (!string.IsNullOrEmpty(driver.Address?.FullAddress)) { driver.Address = _geoLocator.LocateAddress(driver.Address.FullAddress); } _repository.Save(driver); Response.StatusCode = (int)HttpStatusCode.Created; Response.Headers["Location"] = Request.Path.Add($"/{driver.Id}").Value; return(driver.Id); }