public OrganizationModel GetData() { var organizationModel = new OrganizationModel(); //Получаем здания и комнаты с бд var data = factoryContext.Buildings.Include(r => r.Children).ToList(); foreach (var item in data) { var buildingModel = new BuildingModel(); buildingModel.Initialize(factoryContext, item); organizationModel.Buildings.Add(buildingModel); } return(organizationModel); }