public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            try
            {
                var cellData = item as GridCellData;
                if (cellData?.RowData?.RowHandle != null && cellData.RowData.RowHandle.Value != DataControlBase.AutoFilterRowHandle && cellData.RowData?.Row != null)
                {
                    var column = cellData.Column;
                    if (column != null)
                    {
                        var row = cellData.RowData.Row as PmConfiguratorData;
                        if (!string.IsNullOrEmpty(column.FieldName) && row?.Owner != null)
                        {
                            if (!row.Owner.ValidatePmMethods(column.FieldName, row))
                            {
                                if (IsNotAccessible(cellData.Value as List <object>))
                                {
                                    return(NotAllowedPmMethodsCellTemplate);
                                }

                                var validationError = BaseEdit.GetValidationError(cellData);
                                if (validationError == null)
                                {
                                    var newError =
                                        new GridCellValidationError(
                                            Properties.Resources.PmMethodIsUnavailableButExists,
                                            null,
                                            ErrorType.Critical, cellData.RowData.RowHandle.Value,
                                            (GridColumn)column);
                                    BaseEditHelper.SetValidationError(cellData, newError);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _log.WarnFormat("Error in PmMethodCellTemplateSelector {0}", ExceptionHelper.ExceptionToString(ex));
                _log.Debug(ex);
            }
            return(base.SelectTemplate(item, container));
        }