Added check in cosmos for non-existant parent_id

Also added the corresponding test
Raise DataNotFound if cosmos parent not found