private static void OnParentModelPropertyChanged(SpreadsheetCellDataFieldViewModel vm, object parentModel, PropertyChangedEventArgs args)
        {
            if (args.PropertyName == vm._propertyInfo.Name || args.PropertyName == "MasterObject")
            {
                vm.RaisePropertyChanged("DisplayInfo");
                vm.RaisePropertyChanged("Error");

                if (args.PropertyName == "MasterObject" &&
                    vm._fieldViewModelType != typeof(SingleCrossRefFieldViewModel))
                {
                    MethodCaller.CallMethod(parentModel, "RaisePropertyChanged", vm._propertyInfo.Name);
                }
            }
        }
        public Task<ICellDataContextObject> CreateAndInitialize(Type type, PropertyInfo propertyInfo, object model)
        {
            var syncTask = new TaskCompletionSource<ICellDataContextObject>();
            ICellDataContextObject newInstance = null;

            if (typeof(IFieldViewModel).IsAssignableFrom(type))
            {
                var parentModel = model as IEditableProxy;
                var parentDetailsVM = CustomParametres[0] as DetailsViewModel;

                if (parentModel == null || parentDetailsVM == null || propertyInfo == null)
                {
                    syncTask.SetResult(null);
                    return syncTask.Task;
                }

                IColumnItem columnItem = null;
                var columns = CustomParametres[1] as ColumnCollection;
                if (columns != null)
                    columnItem = columns.FirstOrDefault(x => x.Property == propertyInfo);

                if (!parentModel.IsProxyNew)
                {
                    var keyCode = string.Format(CultureInfo.InvariantCulture, "{0}_{1}_{2}", parentModel.GetType().Name, parentModel.Id, propertyInfo.Name);
                    if (!_vmDictionary.TryGetValue(keyCode, out newInstance))
                    {
                        newInstance = new SpreadsheetCellDataFieldViewModel(type, propertyInfo, parentModel, parentDetailsVM, columnItem);
                        _vmDictionary.Add(keyCode, newInstance);
                    }
                    else if (model != ((SpreadsheetCellDataFieldViewModel) newInstance).ParentModel)
                    {
                        newInstance = new SpreadsheetCellDataFieldViewModel(type, propertyInfo, parentModel, parentDetailsVM, columnItem);
                        _vmDictionary[keyCode] = newInstance;
                    }
                }
                else
                    newInstance = new SpreadsheetCellDataFieldViewModel(type, propertyInfo, parentModel, parentDetailsVM, columnItem);
            }

            syncTask.SetResult(newInstance);
            return syncTask.Task;
        }
        private static bool ProcessCRDisplayField(SpreadsheetCellDataFieldViewModel vm)
        {
            var crElement = vm._parentProperty.GetValue(vm._parentPropertyOwner, null) as IEditableProxy;
            if (crElement != null)
            {
                var crElementProperties = crElement.GetAllPropertiesForInstance();
                vm.GetCRDisplayFieldValue(vm._childProperty, crElementProperties[vm._childProperty]);
                return true;
            }

            return false;
        }