public ICommandResult Handle(CreatePatientCommand command) { var patient = new Patient(command.Name, command.Phone, command.DateOfBirth); if (!string.IsNullOrEmpty(command.PhotoPath)) { patient.AddPhoto(command.PhotoPath); } if (command.Id.HasValue) { _repository.Update(patient, command.Id.Value); } else { _repository.Save(patient); } return(new CommandResult(true, "Paciente inserido com sucesso!", new { patient.Id, })); }