Fixes #2. Don't really need to count the keys here. Just need to make sure that the key for the next expected version is not in the database yet. Therefore just check whether the next expected key exists or not.