public AccountPayable Get(
            string name,
            DateTime?dueDate)
        {
            AccountPayable accountToSearch
                = new AccountPayable(name, dueDate);

            AccountPayable account = null;

            if (accountToSearch.IsValid())
            {
                account = this._accountPayableRepository.Get(
                    new object[] { name, dueDate });
            }

            if (account == null)
            {
                accountToSearch.EventNotification.Add(new EventNotificationDescription(
                                                          "Nenhuma conta {0}, com vencimento em {1}.",
                                                          new EventNotificationWarning(), name, dueDate.HasValue ? dueDate.Value.ToShortDateString() : string.Empty));
            }

            NotificationEntity = accountToSearch;

            return(account);
        }
        public void Add(
            string name,
            DateTime?dueDate,
            decimal amount)
        {
            bool created = false;

            AccountPayable account = new AccountPayable(
                name,
                dueDate,
                amount);

            if (account.IsValid())
            {
                this._accountPayableRepository.Create(account);
                created = this._accountPayableRepository.SaveChanges();
            }

            if (created)
            {
                account.EventNotification.Add(NewAccountPayableAdd);
            }

            NotificationEntity = account;
        }