A general class of risk models