public async Task <int> Handle(CreateBicycleCommand request, CancellationToken cancellationToken) { var bicycle = new Bicycle { Name = request.Name, Type = request.Type, Latitude = request.Latitude, Longitude = request.Longitude }; bicycle.AddDomainEvent(new BicycleCreatedEvent(bicycle)); _context.Bicycles.Add(bicycle); await _context.SaveChangesAsync(cancellationToken); return(bicycle.Id); }