moved code to portfolio model