/// <summary>
        /// This method authorizes specified expenditures generating a bill related        
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="expenditureAuthorizationIds"></param>
        public void AuthorizeExpenditures(Int32 companyId, List<Int32> expenditureAuthorizationIds)
        {
            var financialManager = new FinancialManager(this);

            //
            // Creating Parcel
            //

            var parcel = new Parcel();

            decimal parcelAmount = 0;
            parcel.CompanyId = companyId;
            parcel.Description = "1/1";

            var predictableDate = DateTime.Now.AddMonths(1);
            parcel.DueDate = new DateTime(predictableDate.Year, predictableDate.Month, 5);

            //
            // Creating Bill
            //

            var bill = new Bill();

            bill.CompanyId = companyId;
            bill.Description = "Despesas de funcionários";

            var listParcels = new List<Parcel>();
            listParcels.Add(parcel);
            financialManager.Insert(bill, listParcels);

            foreach (var expenditureAuthorizationId in expenditureAuthorizationIds)
            {
                var expenditureAuthorization = GetExpenditureAuthorization(expenditureAuthorizationId);
                expenditureAuthorization.BillId = bill.BillId;

                SetAuthorizationStatusInExpenditure(expenditureAuthorization, false);
                parcelAmount += expenditureAuthorization.Amount;
            }

            parcel.Amount = parcelAmount;

            DbContext.SubmitChanges();
        }
        /// <summary>
        /// this method create and return a list of parcel
        /// </summary>
        /// <returns></returns>
        private List<Parcel> CreateParcelList()
        {
            Parcel parcel;
            List<Parcel> parcelList = new List<Parcel>();
            Int32 index = 0;
            foreach (Payment item in PaymentList)
            {
                parcel = new Parcel();
                parcel.FinancierOperationId = item.FinancierOperationId;
                parcel.Amount = item.Amount;
                parcel.Description = (index + 1).ToString() + "/" + PaymentList.Count();
                parcel.DueDate = item.DueDate;
                parcel.EffectedAmount = null;
                parcel.EffectedDate = null;
                parcel.CompanyId = Company.CompanyId;

#warning verificar de onde vem este numero magico
                if (parcel.FinancierOperationId == 1)
                {
                    parcel.EffectedDate = DateTime.Now;
                    parcel.EffectedAmount = parcel.Amount;
                }
                parcelList.Add(parcel);
                index++;
            }

            return parcelList;
        }
        private List<Parcel> CreateParcelList(decimal total, DateTime firstDatePayment, FinancierCondition condition)
        {
            List<Parcel> parcelList = new List<Parcel>();
            for (int i = 1; i <= condition.ParcelCount; i++)
            {
                decimal amount = Math.Round(total / condition.ParcelCount, 2);
                if (i == 1)
                    amount += (total - (amount * condition.ParcelCount));

                Parcel parcel = new Parcel();
                parcel.FinancierOperationId = condition.FinancierOperationId;
                parcel.Amount = amount;
                parcel.Description = i + "/" + condition.ParcelCount;
                parcel.DueDate = firstDatePayment.AddMonths(i - 1);
                parcel.CompanyId = condition.CompanyId;

                //if (condition.FinancierOperation.PaymentMethod.PaymentMethodTypeId == PaymentMethodType.CashOrOnLineTransfer)
                //{
                //    parcel.EffectedDate = DateTime.Now;
                //    parcel.EffectedAmount = parcel.Amount;
                //}

                parcelList.Add(parcel);
            }
            return parcelList;
        }