moved photo creation logic into photo model