public void Create(GeneticLine geneticLine)
        {
            if (!IsNameAvailable(geneticLine.Name, geneticLine.Id))
            {
                throw new ApplicationException("Ya existe una línea genética con el mismo nombre");
            }

            Uow.GeneticLines.Add(geneticLine);
            Uow.Commit();
        }
        public void Edit(GeneticLine geneticLine)
        {
            var currentGeneticLine = this.GetById(geneticLine.Id);
            var previousWeeks = currentGeneticLine.ProductionWeeks;

            currentGeneticLine.Name = geneticLine.Name;
            currentGeneticLine.ProductionWeeks = geneticLine.ProductionWeeks;

            var standards = currentGeneticLine.StandardGeneticLines.Where(x => !x.IsDeleted).ToList();
            if (standards.Any())
            {
                foreach (var standard in standards)
                {
                    if (previousWeeks < geneticLine.ProductionWeeks)
                    {
                        for (int i = previousWeeks; i < geneticLine.ProductionWeeks; i++)
                        {
                            var item = new StandardItem()
                            {
                                Sequence = i + 1,
                                Value1 = 0,
                                Value2 = 0,
                                StandardGeneticLineId = standard.Id
                            };
                            Uow.StandardItems.Add(item);
                        }
                    }
                    else if (previousWeeks > geneticLine.ProductionWeeks)
                    {
                        var orderedList = standard.StandardItems.Where(x => !x.IsDeleted).OrderBy(x => x.Sequence).ToList();
                        for (int i = geneticLine.ProductionWeeks; i < previousWeeks; i++)
                        {
                            var item = orderedList.ElementAt(i);
                            Uow.StandardItems.Delete(item);
                        }
                    }
                }
            }

            Uow.GeneticLines.Edit(currentGeneticLine);
            Uow.Commit();
        }