public static Earning ToModelToEntity(this EarningModel model)
    {
        var earning = new Earning{
           ListItemsEarning = model.ListItemsEarningModel.Select(x => x.ModelToEntity())
        };
 
        return earning;
    }
        public static Earning ToModelToEntity(this EarningModel model)
        {
            var earning = new Earning {
                ListItemsEarning = model.ListItemsEarningModel.Select(x => x.ModelToEntity())
            };

            return(earning);
        }
        public async Task<MonthFinanceModel> SaveMonthFinance([FromBody] MonthFinanceModel monthFinances)
        {
            var documents = (await monthFinanceConfPer.Get()).ToArray();
            var entity = documents.Where(x=> x.Name == monthFinances.Name).FirstOrDefault();
            
            if(entity.Name != null)
            {
                var entityExpense = new Expense {
                    ListItemsExpense = monthFinances.Expense.ListItemsExpenseModel.Select(x=>x.ModelToEntity())
                };

                var entityEarning = new Earning
                {
                    ListItemsEarning = monthFinances.Earning.ListItemsEarningModel.Select(x=>x.ModelToEntity())
                };
                    
                var entityInvestment = new Investment
                {
                    ListItemsInvestment = monthFinances.Investment.ListItemsInvestmentModel.Select(x=>x.ModelToEntity())  
                };

                entity.MonthEarning = entityEarning;
                entity.MonthExpense = entityExpense;
                entity.MonthInvestment = entityInvestment;

                await monthFinanceConfPer.Persist(entity);
            }    
            return entity.ToMonthFinanceModel();
        }