added check if entity exists when saving rest collection