Refactoring of SetTagKeyMixin and SetTimeKeyMixin.