function groupVariantsByContextEntry(aVariants, oFinalStates) {
		var mUniqueContexts = {};
		var aUnrestrictedViews = [];
		aVariants.forEach(function(oVariant) {
			var oFinalState = oFinalStates[oVariant.getId()];
			// We do not need to copy invisible variants
			if (oFinalState.visible) {
				var bUnrestricted = true;
				// TODO Needs to be enhanced if there can be multiple context types in parallel
				var aContextKeys = Object.keys(oFinalState.contexts);
				aContextKeys.forEach(function(sKey) {
					var aContexts = Array.from(oFinalState.contexts[sKey]);

					aContexts.forEach(function(sContext) {
						bUnrestricted = false;
						if (mUniqueContexts[sContext]) {
							mUniqueContexts[sContext].variants.push(oVariant);
						} else {
							mUniqueContexts[sContext] = {
								contextBasedAdaptationId: FlexUtils.createDefaultFileName(),
								variants: [oVariant]
							};
						}
					});
				});
				if (bUnrestricted) {
					aUnrestrictedViews.push(oVariant);
				}
			}
		});
		return {uniqueContexts: mUniqueContexts, unrestrictedViews: aUnrestrictedViews};
	}
Builds a map containing unique contextKeys (as key) with their respective variants and variants changes and a list of unrestricted views.
@param {sap.ui.fl.apply._internal.flexObjects.Variant[]} aVariants - Variants object
@param {object[]} oFinalStates - Final states of variants
@returns {object} An object with both results