/**
  * @param string $key
  * @param SearchAttributesDataCollection $dataCollection
  * @param array $stickyData
  */
 public static function setDataByKeyAndDataCollection($key, SearchAttributesDataCollection $dataCollection, $stickyData)
 {
     assert('is_string($key)');
     assert('is_array($stickyData)');
     $stickyData['dynamicClauses'] = $dataCollection->getSanitizedDynamicSearchAttributes();
     $stickyData['dynamicStructure'] = $dataCollection->getDynamicStructure();
     if ($dataCollection->getFilterByStarred() != null) {
         $stickyData['filterByStarred'] = $dataCollection->getFilterByStarred();
     }
     if ($dataCollection->getFilteredBy() != null) {
         $stickyData['filteredBy'] = $dataCollection->getFilteredBy();
     }
     $anyMixedAttributes = $dataCollection->resolveSearchAttributesFromSourceData();
     if (isset($anyMixedAttributes['anyMixedAttributes'])) {
         $stickyData['anyMixedAttributes'] = $anyMixedAttributes['anyMixedAttributes'];
     } else {
         unset($stickyData['anyMixedAttributes']);
     }
     $dataCollection->resolveAnyMixedAttributesScopeForSearchModelFromSourceData();
     $dataCollection->resolveSelectedListAttributesForSearchModelFromSourceData();
     $dataCollection->resolveKanbanBoardOptionsForSearchModelFromSourceData();
     $stickyData['anyMixedAttributesScope'] = $dataCollection->getAnyMixedAttributesScopeFromModel();
     $stickyData[SearchForm::SELECTED_LIST_ATTRIBUTES] = $dataCollection->getSelectedListAttributesFromModel();
     static::resolveKanbanBoardDataByCollection($dataCollection, $stickyData);
     if ($dataCollection instanceof SavedSearchAttributesDataCollection) {
         $stickyData['savedSearchId'] = $dataCollection->getSavedSearchId();
     }
     // Resolve the sort and desc attribute from source data and set it in sticky array
     $listSortModel = get_class($dataCollection->getModel()->getModel());
     $sortAttribute = $dataCollection->resolveSortAttributeFromSourceData($listSortModel);
     //There are two cases
     //a) When user clicks on sorting in grid view, at that time Model Class inside form is used
     //b) When user save the search, sort attributes are in form model
     if ($sortAttribute == null) {
         $sortAttribute = $dataCollection->resolveSortAttributeFromSourceData(get_class($dataCollection->getModel()));
     }
     if (!empty($sortAttribute)) {
         $stickyData['sortAttribute'] = $sortAttribute;
         if ($dataCollection->resolveSortDescendingFromSourceData($listSortModel)) {
             $stickyData['sortDescending'] = true;
         } else {
             $sortDescending = $dataCollection->resolveSortDescendingFromSourceData(get_class($dataCollection->getModel()));
             if ($sortDescending === true) {
                 $stickyData['sortDescending'] = true;
             } else {
                 $stickyData['sortDescending'] = false;
             }
         }
     }
     StickySearchUtil::setDataByKeyAndData($key, $stickyData);
 }