public PettyCash Update(PettyCash t)
        {
            if (t.Id <= 0)
            {
                throw new ArgumentException("Invalid PettyCash Id");
            }

            PettyCash f = Get(t.Id);

            if (f == null)
            {
                throw new ArgumentNullException($"PettyCash with id {t.Id} does not exist or its deleted");
            }


            f.PaidTo        = t.PaidTo;
            f.Description   = t.Description;
            f.Amount        = t.Amount;
            f.PaymentMode   = t.PaymentMode;
            f.TransactionId = t.TransactionId;
            f.ReceivedDate  = t.ReceivedDate;
            f.EntryBy       = t.EntryBy;
            f.Status        = t.Status;
            f.AttachedFiles = t.AttachedFiles;

            f = DbStore.Save <PettyCash>(f);

            return(f);
        }
        public void Delete(long id)
        {
            PettyCash r = Get(id);

            DbStore.Delete <PettyCash>(r);
            pettycashes.Remove(r);
        }
        public PettyCash Add(PettyCash t)
        {
            if (!IsDuplicate(t))
            {
                t.Id = 0;
                var ret = DbStore.Save <PettyCash>(t);

                if (ret != null)
                {
                    pettycashes.Add(ret);
                }

                return(ret);
            }
            else
            {
                throw new DuplicateItemException("Member  already exists");
            }
        }
 bool IsDuplicate(PettyCash r)
 {
     return(pettycashes.Exists(d => (d.Description == r.Description && d.Amount == r.Amount)));
 }