public TransferConnectionInvitation SendTransferConnectionInvitation(Account receiverAccount, User senderUser, decimal senderAccountTransferAllowance)
        {
            RequiresTransferConnectionInvitationSenderIsNotTheReceiver(receiverAccount);
            RequiresMinTransferAllowanceIsAvailable(senderAccountTransferAllowance);
            RequiresTransferConnectionInvitationSenderIsNotAReceiver();
            RequiresTransferConnectionInvitationReceiverIsNotASender(receiverAccount);
            RequiresTransferConnectionInvitationDoesNotExist(receiverAccount);

            var transferConnectionInvitation = new TransferConnectionInvitation(this, receiverAccount, senderUser);

            SentTransferConnectionInvitations.Add(transferConnectionInvitation);

            return(transferConnectionInvitation);
        }
        private void RequiresTransferConnectionInvitationDoesNotExist(Account receiverAccount)
        {
            var anyReceivedTransferConnectionInvitations = ReceivedTransferConnectionInvitations.Any(i =>
                                                                                                     i.SenderAccount.Id == receiverAccount.Id && (
                                                                                                         i.Status == TransferConnectionInvitationStatus.Pending ||
                                                                                                         i.Status == TransferConnectionInvitationStatus.Approved));

            var anySentTransferConnectionInvitations = SentTransferConnectionInvitations.Any(i =>
                                                                                             i.ReceiverAccount.Id == receiverAccount.Id && (
                                                                                                 i.Status == TransferConnectionInvitationStatus.Pending ||
                                                                                                 i.Status == TransferConnectionInvitationStatus.Approved));

            if (anyReceivedTransferConnectionInvitations || anySentTransferConnectionInvitations)
            {
                throw new Exception("Requires transfer connection invitation does not exist");
            }
        }
 public bool IsTransferConnectionInvitationSender()
 {
     return(SentTransferConnectionInvitations.Any(i =>
                                                  i.Status == TransferConnectionInvitationStatus.Pending ||
                                                  i.Status == TransferConnectionInvitationStatus.Approved));
 }