public async Task <ProjectUserInvitationGetRp> GetInvitationById(Guid invitationId)
        {
            var entity = await _projectUserInvitationRepository.GetProjectUserInvitationById(invitationId);

            ProjectUserInvitationGetRp invitation = null;

            if (entity != null)
            {
                invitation = new ProjectUserInvitationGetRp()
                {
                    InvitationId     = entity.ProjectUserInvitationId,
                    UserEmail        = entity.UserEmail,
                    Role             = entity.Role,
                    InvitationStatus = entity.InvitationStatus,
                    AcceptedDate     = entity.AcceptedDate,
                    CreationDate     = entity.CreationDate
                };
            }

            return(invitation);
        }
        public async Task AcceptInvitation(Guid organizationId, Guid projectId, Guid invitationId)
        {
            string loggedUserId    = _identityService.GetUserId();
            string loggedUserEmail = _identityService.GetUserEmail();

            User user = await _userRepository.GetUser(loggedUserId);

            ProjectUserInvitation projectUserInvitation = await _projectUserInvitationRepository.GetProjectUserInvitationById(invitationId);

            if (projectUserInvitation == null)
            {
                await _domainManagerService.AddNotFound($"The invitation with id {invitationId} does not exists.");

                return;
            }

            if (!loggedUserEmail.Equals(projectUserInvitation.UserEmail, StringComparison.InvariantCultureIgnoreCase))
            {
                await _domainManagerService.AddForbidden($"You are not authorized to accept this invitation.");

                return;
            }

            if (projectUserInvitation.InvitationStatus != UserInvitationStatus.Pending)
            {
                await _domainManagerService.AddConflict($"The invitation with id {invitationId} cannot be accepted. Only invitations in status pending can be accepted.");

                return;
            }

            projectUserInvitation.Accept();

            //Grant User Access
            projectUserInvitation.Project.GrantUserAccess(loggedUserId, projectUserInvitation.Role);

            await _projectUserInvitationRepository.SaveChanges();
        }