public async Task <bool> Create(CompanyFileGrouping CompanyFileGrouping)
        {
            CompanyFileGroupingDAO CompanyFileGroupingDAO = new CompanyFileGroupingDAO();

            CompanyFileGroupingDAO.Id          = CompanyFileGrouping.Id;
            CompanyFileGroupingDAO.Title       = CompanyFileGrouping.Title;
            CompanyFileGroupingDAO.Description = CompanyFileGrouping.Description;
            CompanyFileGroupingDAO.CompanyId   = CompanyFileGrouping.CompanyId;
            CompanyFileGroupingDAO.CreatorId   = CompanyFileGrouping.CreatorId;
            CompanyFileGroupingDAO.FileTypeId  = CompanyFileGrouping.FileTypeId;
            CompanyFileGroupingDAO.RowId       = CompanyFileGrouping.RowId;
            CompanyFileGroupingDAO.CreatedAt   = StaticParams.DateTimeNow;
            CompanyFileGroupingDAO.UpdatedAt   = StaticParams.DateTimeNow;
            DataContext.CompanyFileGrouping.Add(CompanyFileGroupingDAO);
            await DataContext.SaveChangesAsync();

            CompanyFileGrouping.Id = CompanyFileGroupingDAO.Id;
            await SaveReference(CompanyFileGrouping);

            return(true);
        }
        public async Task <bool> BulkMerge(List <CompanyFileGrouping> CompanyFileGroupings)
        {
            List <CompanyFileGroupingDAO> CompanyFileGroupingDAOs = new List <CompanyFileGroupingDAO>();

            foreach (CompanyFileGrouping CompanyFileGrouping in CompanyFileGroupings)
            {
                CompanyFileGroupingDAO CompanyFileGroupingDAO = new CompanyFileGroupingDAO();
                CompanyFileGroupingDAO.Id          = CompanyFileGrouping.Id;
                CompanyFileGroupingDAO.Title       = CompanyFileGrouping.Title;
                CompanyFileGroupingDAO.Description = CompanyFileGrouping.Description;
                CompanyFileGroupingDAO.CompanyId   = CompanyFileGrouping.CompanyId;
                CompanyFileGroupingDAO.CreatorId   = CompanyFileGrouping.CreatorId;
                CompanyFileGroupingDAO.FileTypeId  = CompanyFileGrouping.FileTypeId;
                CompanyFileGroupingDAO.RowId       = CompanyFileGrouping.RowId;
                CompanyFileGroupingDAO.CreatedAt   = StaticParams.DateTimeNow;
                CompanyFileGroupingDAO.UpdatedAt   = StaticParams.DateTimeNow;
                CompanyFileGroupingDAOs.Add(CompanyFileGroupingDAO);
            }
            await DataContext.BulkMergeAsync(CompanyFileGroupingDAOs);

            return(true);
        }
        public async Task <bool> Update(CompanyFileGrouping CompanyFileGrouping)
        {
            CompanyFileGroupingDAO CompanyFileGroupingDAO = DataContext.CompanyFileGrouping.Where(x => x.Id == CompanyFileGrouping.Id).FirstOrDefault();

            if (CompanyFileGroupingDAO == null)
            {
                return(false);
            }
            CompanyFileGroupingDAO.Id          = CompanyFileGrouping.Id;
            CompanyFileGroupingDAO.Title       = CompanyFileGrouping.Title;
            CompanyFileGroupingDAO.Description = CompanyFileGrouping.Description;
            CompanyFileGroupingDAO.CompanyId   = CompanyFileGrouping.CompanyId;
            CompanyFileGroupingDAO.CreatorId   = CompanyFileGrouping.CreatorId;
            CompanyFileGroupingDAO.FileTypeId  = CompanyFileGrouping.FileTypeId;
            CompanyFileGroupingDAO.RowId       = CompanyFileGrouping.RowId;
            CompanyFileGroupingDAO.UpdatedAt   = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(CompanyFileGrouping);

            return(true);
        }