Trying to get property 'Id' of non-object