public void Handle(AddPrescriptionCommand command) { var medicines = new List <Medicine>(); foreach (var medicine in command.Medicines) { medicines.Add(new Medicine(0, medicine.Key, medicine.Value)); } prescriptionRepository.AddPrescriptionAsync(new PrescriptionObject(0, command.IdDoctor, command.IdPatient, command.Date, command.DateOfExpiration, medicines)); }