public async Task <Unit> Handle(SendMeetingGroupCreatedEmailCommand request, CancellationToken cancellationToken)
        {
            var connection = _sqlConnectionFactory.GetOpenConnection();

            var meetingGroup = await connection.QuerySingleAsync <MeetingGroupDto>("SELECT " +
                                                                                   "[MeetingGroup].[Name], " +
                                                                                   "[MeetingGroup].[LocationCountryCode], " +
                                                                                   "[MeetingGroup].[LocationCity] " +
                                                                                   "FROM [meetings].[v_MeetingGroups] AS [MeetingGroup] " +
                                                                                   "WHERE [MeetingGroup].[Id] = @Id", new
            {
                Id = request.MeetingGroupId.Value
            });

            var member = await MembersQueryHelper.GetMember(request.CreatorId, connection);

            var email = new EmailMessage(
                member.Email,
                $"{meetingGroup.Name} created",
                $"{meetingGroup.Name} created at {meetingGroup.LocationCity}, {meetingGroup.LocationCountryCode}");

            _emailSender.SendEmail(email);

            return(Unit.Value);
        }
        public async Task <Unit> Handle(SendMeetingAttendeeAddedEmailCommand request, CancellationToken cancellationToken)
        {
            var connection = _sqlConnectionFactory.GetOpenConnection();

            var member = await MembersQueryHelper.GetMember(request.AttendeeId, connection);

            var meeting = await MeetingsQueryHelper.GetMeeting(request.MeetingId, connection);

            var email = new EmailMessage(member.Email, $"You joined to {meeting.Title} meeting.",
                                         $"You joined to {meeting.Title} title at {meeting.TermStartDate.ToShortDateString()} - {meeting.TermEndDate.ToShortDateString()}, location {meeting.LocationAddress}, {meeting.LocationPostalCode}, {meeting.LocationCity}");

            _emailSender.SendEmail(email);

            return(Unit.Value);
        }
        public async Task <Unit> Handle(AddMeetingCommentLikeCommand request, CancellationToken cancellationToken)
        {
            var meetingComment = await _meetingCommentRepository.GetByIdAsync(new MeetingCommentId(request.MeetingCommentId));

            if (meetingComment == null)
            {
                throw new InvalidCommandException(new List <string> {
                    "To add like the comment must exist."
                });
            }

            var connection = _sqlConnectionFactory.GetOpenConnection();
            var likerMeetingGroupMemberData = await MembersQueryHelper.GetMeetingGroupMember(_memberContext.MemberId, meetingComment.GetMeetingId(), connection);

            var meetingMemeberCommentLikesCount = await _meetingMemberCommentLikesRepository.CountMemberCommentLikesAsync(
                _memberContext.MemberId,
                new MeetingCommentId(request.MeetingCommentId));

            var like = meetingComment.Like(_memberContext.MemberId, likerMeetingGroupMemberData, meetingMemeberCommentLikesCount);

            await _meetingMemberCommentLikesRepository.AddAsync(like);

            return(Unit.Value);
        }