public ReproductionStep EditReproductionStep(ReproductionStep reproductionStep)
 {
     using (var database = new Core.Entity.SeedsEntities())
     {
         var entity = database.ReproductionStep.Single(e => e.ID == reproductionStep.ID);
         reproductionStep.ApplyChanges(database, entity);
         database.SaveChanges();
         var result = new ReproductionStep(entity);
         Cache.Instance.Plants[result.Plant.ID].ReproductionSteps[result.ID] = result;
         return result;
     }
 }
 public ReproductionStep CreateReproductionStep(ReproductionStep reproductionStep)
 {
     using (var database = new Core.Entity.SeedsEntities())
     {
         var entity = reproductionStep.ToEntity(database);
         entity.ID = database.ReproductionStep.Execute(MergeOption.NoTracking).Any() ? database.ReproductionStep.Execute(MergeOption.NoTracking).Max(rs => rs.ID) + 1 : 0;
         database.AddToReproductionStep(entity);
         database.SaveChanges();
         var newEntity = database.ReproductionStep.Execute(MergeOption.NoTracking).Single(rs => rs.ID == entity.ID);
         var result = new ReproductionStep(newEntity);
         var plant = Cache.Instance.Plants[newEntity.PlantID];
         result.Plant = plant;
         plant.ReproductionSteps[result.ID] = result;
         return result;
     }
 }