private async Task ProcessResponseInternalElement(HttpContext context,
                                                          ModelFromClientCollection fromClient,
                                                          ModelToClient model)
        {
            // Send object data.
            model.data = new Dictionary <string, string>(Decorator.ListProperties.Count);
            if (fromClient.dataNames != null)
            {
                for (int index = 0; index < fromClient.dataNames.Count; ++index)
                {
                    PropertyDefinition prop = Decorator.Properties[fromClient.dataNames[index]];

                    model.data.Add(prop.FieldName, await prop.GetValue(this));
                }
            }

            model.isNew      = IsNew;
            model.isModified = IsModified;
            model.isDeleting = IsDeleting;

            if (clientRefreshPending && !model.refreshAll)
            {
                model.refreshAll = true;
            }

            model.title = Title;

            // First level now...
            //if (relatedCollections.Count > 0)
            //{
            //    model.collections = new Dictionary<string, List<ModelToClient>>(relatedCollections.Count);

            //    foreach (BusinessCollectionBase col in relatedCollections.Values)
            //    {
            //        List<ModelToClient> elements = new List<ModelToClient>(col.Count);

            //        foreach (BusinessBase obj in col)
            //        {
            //            elements.Add(obj.CreateResponse(null, null));
            //        }
            //    }
            //}
        }
        public async Task <ModelToClient> ProcessRequestInternalElement(HttpContext context, ModelFromClientCollection fromClient,
                                                                        ModelFromClientData element, string fromClientAction)
        {
            ModelToClient model = new ModelToClient
            {
                wasNew      = IsNew,
                wasDeleting = IsDeleting,
                wasModified = IsModified,
                keyObject   = Key
            };

            // Too much copy/paste
            if (element != null)
            {
                if (fromClientAction == "changed" || fromClientAction == "ok")
                {
                    if (element.data != null)
                    {
                        foreach (KeyValuePair <string, string> item in element.data)
                        {
                            PropertyDefinition prop = Decorator.Properties[item.Key];

                            await prop.SetValue(this, item.Value);
                        }
                    }
                }
            }

            return(model);
        }