Optimal investment for investors with state dependent income, and for insurers · Study