/// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public virtual Task MethodBodyExecute(object key)
        {
            try
            {
                String innerMethod = EXECUTE_METHOD;
                bool   wrapped     = true;
                Dictionary <string, object> bodyParameters = null;
                if (IsCoreEventReplicator(_procWorker))
                {
                    bodyParameters = ReadBodyParameters();
                    string synchronizer = PreProcessReplicatorParameteres(_procWorker, innerMethod, bodyParameters);
                    if (!IsAuthenticated(synchronizer))
                    {
                        return(Task.CompletedTask);
                    }
                }
                else if (!IsAuthenticated())
                {
                    return(Task.CompletedTask);
                }
                if (Worker.UploadEnabled() && GxUploadHelper.IsUploadURL(_httpContext))
                {
                    GXObjectUploadServices gxobject = new GXObjectUploadServices(_gxContext);
                    gxobject.webExecute();
                    return(Task.CompletedTask);
                }
                if (!ProcessHeaders(_procWorker.GetType().Name))
                {
                    return(Task.CompletedTask);
                }
                _procWorker.IsMain = true;
                if (bodyParameters == null)
                {
                    bodyParameters = ReadBodyParameters();
                }

                if (_procWorker.IsSynchronizer2)
                {
                    innerMethod = SynchronizerMethod();
                    PreProcessSynchronizerParameteres(_procWorker, innerMethod, bodyParameters);
                    wrapped = false;
                }

                if (!String.IsNullOrEmpty(this.ServiceMethod))
                {
                    innerMethod = this.ServiceMethod;
                }
                Dictionary <string, object> outputParameters = ReflectionHelper.CallMethod(_procWorker, innerMethod, bodyParameters, _gxContext);

                wrapped = GetWrappedStatus(_procWorker, wrapped, outputParameters);
                setWorkerStatus(_procWorker);
                _procWorker.cleanup();
                RestProcess(outputParameters);
                return(Serialize(outputParameters, wrapped, _procWorker.IsApiObject));
            }
            catch (Exception e)
            {
                return(WebException(e));
            }
            finally
            {
                Cleanup();
            }
        }
        public void UploadImpl(Stream stream)
        {
            GXObjectUploadServices gxobject = new GXObjectUploadServices(context);

            gxobject.WcfExecute(stream, WebOperationContext.Current.IncomingRequest.ContentType);
        }
        public override Task Post()
        {
            try
            {
                if (!IsAuthenticated())
                {
                    return(Task.CompletedTask);
                }
                if (Worker.UploadEnabled() && GxUploadHelper.IsUploadURL(_httpContext))
                {
                    GXObjectUploadServices gxobject = new GXObjectUploadServices(_gxContext);
                    gxobject.webExecute();
                    return(Task.CompletedTask);
                }
                bool gxcheck          = IsRestParameter(CHECK_PARAMETER);
                bool gxinsertorupdate = IsRestParameter(INSERT_OR_UPDATE_PARAMETER);

                GxSilentTrnSdt entity           = (GxSilentTrnSdt)Activator.CreateInstance(_worker.GetType(), new Object[] { _gxContext });
                var            entity_interface = MakeRestType(entity);
                entity_interface = ReadRequestBodySDTObj(entity_interface.GetType());

                var worker_interface = MakeRestType(_worker);

                worker_interface.GetType().GetMethod("CopyFrom").Invoke(worker_interface, new object[] { entity_interface });
                if (gxcheck)
                {
                    _worker.Check();
                }
                else
                {
                    if (gxinsertorupdate)
                    {
                        _worker.InsertOrUpdate();
                    }
                    else
                    {
                        _worker.Save();
                    }
                }
                if (_worker.Success())
                {
                    if (!gxcheck)
                    {
                        _worker.trn.context.CommitDataStores();
                        SetStatusCode(HttpStatusCode.Created);
                    }
                    SetMessages(_worker.trn.GetMessages());
                    return(Serialize(MakeRestType(_worker)));
                }
                else
                {
                    Cleanup();
                    return(ErrorCheck(_worker.trn));
                }
            }
            catch (Exception e)
            {
                return(WebException(e));
            }
            finally
            {
                Cleanup();
            }
        }