Resolved some errors related to saving entities