public async Task <DomainResult <ObjectId> > Handle(CreatePointCommand command, CancellationToken cancellationToken) { var point = Point.Create(command); var alreadyExists = await _pointRepository.AlreadyExistsAsync(x => x.IsTheSame(point)); if (alreadyExists) { return(DomainResult.Failure <ObjectId>("Point already exists", HttpStatusCode.Conflict)); } await _pointRepository.CreateAsync(point); await _mediator.Publish(new PointCreatedEvent(point)); return(DomainResult.Ok(point.Id)); }