/// <inheritdoc />
        public async Task <Result> Handle(CancelPersonalEventCommand request, CancellationToken cancellationToken)
        {
            Maybe <PersonalEvent> maybePersonalEvent = await _personalEventRepository.GetByIdAsync(request.PersonalEventId);

            if (maybePersonalEvent.HasNoValue)
            {
                return(Result.Failure(DomainErrors.PersonalEvent.NotFound));
            }

            PersonalEvent personalEvent = maybePersonalEvent.Value;

            if (personalEvent.UserId != _userIdentifierProvider.UserId)
            {
                return(Result.Failure(DomainErrors.User.InvalidPermissions));
            }

            Result result = personalEvent.Cancel(_dateTime.UtcNow);

            if (result.IsFailure)
            {
                return(result);
            }

            await _unitOfWork.SaveChangesAsync(cancellationToken);

            return(Result.Success());
        }
        /// <inheritdoc />
        public async Task <Result> Handle(UpdatePersonalEventCommand request, CancellationToken cancellationToken)
        {
            if (request.DateTimeUtc <= _dateTime.UtcNow)
            {
                return(Result.Failure(DomainErrors.PersonalEvent.DateAndTimeIsInThePast));
            }

            Maybe <PersonalEvent> maybePersonalEvent = await _personalEventRepository.GetByIdAsync(request.PersonalEventId);

            if (maybePersonalEvent.HasNoValue)
            {
                return(Result.Failure(DomainErrors.PersonalEvent.NotFound));
            }

            PersonalEvent personalEvent = maybePersonalEvent.Value;

            if (personalEvent.UserId != _userIdentifierProvider.UserId)
            {
                return(Result.Failure(DomainErrors.User.InvalidPermissions));
            }

            Result <Name> nameResult = Name.Create(request.Name);

            if (nameResult.IsFailure)
            {
                return(Result.Failure(nameResult.Error));
            }

            personalEvent.ChangeName(nameResult.Value);

            personalEvent.ChangeDateAndTime(request.DateTimeUtc);

            await _unitOfWork.SaveChangesAsync(cancellationToken);

            return(Result.Success());
        }