@classmethod
def get_by_user_or_404(cls, item_id, user):
    """
        return the object with the given id that is owned by the given user

        :param item_id: object id
        :param user: the user to use as a filter, assumes relationship name is user
        :return: the object
        :throws: 404 exception if not found
        """
    return cls.query.filter_by(id=item_id, user=user).first_or_404()
