added additional safety check to make sure we have all resource information we need before writing to the repository