public static Company ConvertToDbCompany(this CompanyModel model, ICompanyBusinessLogic companyBusinessLogic , IContactBusinessLogic contactBusinessLogic) { var company = companyBusinessLogic.GetById(model.Id); company.Comment = model.Comment; //company.CreateDate = DateTime.Now; company.Name = model.Name; company.Sites.AddRange(companyBusinessLogic.GetAllSites(company.Id)); //company.IsDeleted = false; company.Type = companyBusinessLogic.GetAllTypes().First(x => x.Id == model.TypeId); company.Size = companyBusinessLogic.GetAllSizes().First(x => x.Id == model.SizeId); company.Sector = companyBusinessLogic.GetAllSectors().First(x => x.Id == model.SectorId); company.Status = companyBusinessLogic.GetAllStatuses().First(x => x.Id == model.StatusId); company.Owner = contactBusinessLogic.GetById(model.OwnerId); return company; }