public void Handle(CreateLicenseCommand command) { var software = _repository.Load <LicensedSoftware>(command.SoftwareId); if (software is null) { throw new Exception("You cannot link a license to non-licensed software"); } software.AddLicense(command.Key, command.DateStart, command.DateEnd, OrganizationId.Parse(command.OrganizationId), command.Activations, command.Price, command.Description); _repository.Save(software); }