Fixed wrong condition in Repository::persist method