public IConnectionResponse Options(IConnectionRequest connectionRequest) 
        {
		
		    if(connectionRequest == null) 
            {
			    Log.Error(typeof(HttpConnectionWorker).Name, "Options", "Invalid Connection Request.");
                throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Options", "Invalid Connection Request.");
		    }
            
		    /*
		     * Request Parameters
		     */
		    StringBuilder url = new StringBuilder(connectionRequest.GetUrl());
		
		    IEnumerator<String> queryParameters = connectionRequest.GetQueryParameters();
		    IEnumerator<String> headerParameters = connectionRequest.GetHeaderParameters();
		
		
		    /*
		     * Add Query Parameters
		     */
            int count = 0;
		    while(queryParameters.MoveNext()) 
            {
			
			    String parameter = queryParameters.Current;
			    Connect.Model.ServiceDescriptor.Request.QueryParameter queryParameter = connectionRequest.GetQueryParameter(parameter);

                if (count == 0)
                {
                    url.Append("?");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
                else
                {
                    url.Append("&");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
            }


            /*
             * Make Request
             */
            HttpClient httpClient = new HttpClient();
            HttpResponseMessage httpResponse;
			
		
		    /*
		     * Add Header Parameters
		     */
		    while(headerParameters.MoveNext()) 
            {
			
			    String header = headerParameters.Current;
			    Connect.Model.ServiceDescriptor.Request.HeaderParameter headerParameter = connectionRequest.GetHeaderParameter(header);

                httpClient.DefaultRequestHeaders.TryAddWithoutValidation(header, headerParameter.GetValue());
            }
		

		
            /* execute */
        
            try 
            {
                Task<HttpResponseMessage> httpResponseMessage = null;// httpClient.GetAsync(url.ToString());
                httpResponseMessage.Wait();

                httpResponse = httpResponseMessage.Result; 
            } 
            catch(System.Exception exception) 
            {
                Log.Error(typeof(HttpConnectionWorker).Name, "Options", "Exception caught while executing request, " + exception.Message);
                throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Options", "Exception caught while executing request, " + exception.Message);
            }



            /* return response */
            if (!httpResponse.IsSuccessStatusCode)
            {
                return (IConnectionResponse)new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), new ConnectionStatusCodes().GetStatusMessage(Convert.ToInt32(httpResponse.StatusCode.ToString())));
            }


            Task<Stream> repsonseStreamAsync = httpResponse.Content.ReadAsStreamAsync();
            repsonseStreamAsync.Wait();

            Stream responseStream = repsonseStreamAsync.Result;

            return (IConnectionResponse)new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), responseStream);
	    }
        public IConnectionResponse Options(IConnectionRequest connectionRequest)
        {
            if (connectionRequest == null)
            {
                Log.Error(typeof(HttpConnectionWorker).Name, "Options", "Invalid Connection Request.");
                throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Options", "Invalid Connection Request.");
            }

            /*
             * Request Parameters
             */
            StringBuilder url = new StringBuilder(connectionRequest.GetUrl());

            IEnumerator <String> queryParameters  = connectionRequest.GetQueryParameters();
            IEnumerator <String> headerParameters = connectionRequest.GetHeaderParameters();


            /*
             * Add Query Parameters
             */
            int count = 0;

            while (queryParameters.MoveNext())
            {
                String parameter = queryParameters.Current;
                Connect.Model.ServiceDescriptor.Request.QueryParameter queryParameter = connectionRequest.GetQueryParameter(parameter);

                if (count == 0)
                {
                    url.Append("?");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
                else
                {
                    url.Append("&");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
            }


            /*
             * Make Request
             */
            HttpClient          httpClient = new HttpClient();
            HttpResponseMessage httpResponse;


            /*
             * Add Header Parameters
             */
            while (headerParameters.MoveNext())
            {
                String header = headerParameters.Current;
                Connect.Model.ServiceDescriptor.Request.HeaderParameter headerParameter = connectionRequest.GetHeaderParameter(header);

                httpClient.DefaultRequestHeaders.TryAddWithoutValidation(header, headerParameter.GetValue());
            }



            /* execute */

            try
            {
                Task <HttpResponseMessage> httpResponseMessage = null;// httpClient.GetAsync(url.ToString());
                httpResponseMessage.Wait();

                httpResponse = httpResponseMessage.Result;
            }
            catch (System.Exception exception)
            {
                Log.Error(typeof(HttpConnectionWorker).Name, "Options", "Exception caught while executing request, " + exception.Message);
                throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Options", "Exception caught while executing request, " + exception.Message);
            }



            /* return response */
            if (!httpResponse.IsSuccessStatusCode)
            {
                return((IConnectionResponse) new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), new ConnectionStatusCodes().GetStatusMessage(Convert.ToInt32(httpResponse.StatusCode.ToString()))));
            }


            Task <Stream> repsonseStreamAsync = httpResponse.Content.ReadAsStreamAsync();

            repsonseStreamAsync.Wait();

            Stream responseStream = repsonseStreamAsync.Result;

            return((IConnectionResponse) new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), responseStream));
        }
        public IConnectionResponse Get(IConnectionRequest connectionRequest) 
        {

		    if(connectionRequest == null) 
            {
			    Log.Error(typeof(HttpConnectionWorker).Name, "Get", "Invalid Connection Request.");
			    throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Get", "Invalid Connection Request.");
		    }

            /*if (connectionRequest.GetUrl().Contains("get_books"))
            {
                String books = "<books><book><name>C</name><description>C Description</description><author>C Author</author><link>C Link</link></book><book><name>C Plus</name><description>C Plus Description</description><author>C Plus Author</author><link>C Plus Link</link></book><book><name>C Sharp</name><description>C Sharp Description</description><author>C Sharp Author</author><link>C Sharp Link</link></book><book><name>Java</name><description>Java Description</description><author>Java Author</author><link>Java Link</link></book><book><name>JavaScript</name><description>JavaScript Description</description><author>JavaScript Author</author><link>JavaScript Link</link></book><book><name>Swift</name><description>Swift Description</description><author>Swift Author</author><link>Swift Link</link></book><book><name>Objective C</name><description>Objective C Description</description><author>Objective C Author</author><link>Objective C Link</link></book></books>";
                Stream booksStream;

                byte[] bytes = new byte[books.Length * sizeof(char)];
                System.Buffer.BlockCopy(books.ToCharArray(), 0, bytes, 0, bytes.Length);

                try
                {
                    booksStream = Utils.Utils.ToStream(bytes);
                    return new ConnectionResponse(200, booksStream);
                }
                catch (SiminovException se)
                {

                }
            }
            else
            {
                String lessions = "<lessions><lession><name>C First Lession</name><description>C First Lession Description</description><link>C First Lession Link</link></lession><lession><name>C Second Lession</name><description>C Second Lession Description</description><link>C Second Lession Link</link></lession></lessions>";
                Stream lessionsStream;

                byte[] bytes = new byte[lessions.Length * sizeof(char)];
                System.Buffer.BlockCopy(lessions.ToCharArray(), 0, bytes, 0, bytes.Length);

                try
                {
                    lessionsStream = Utils.Utils.ToStream(bytes);
                    return new ConnectionResponse(200, lessionsStream);
                }
                catch (SiminovException se)
                {

                }
            }

            return new ConnectionResponse(200, "");*/
		

		    /*
		     * Request Parameters
		     */
		    StringBuilder url = new StringBuilder(connectionRequest.GetUrl());
		
		    IEnumerator<String> queryParameters = connectionRequest.GetQueryParameters();
		    IEnumerator<String> headerParameters = connectionRequest.GetHeaderParameters();
		
		
		    /*
		     * Make Request
		     */
            HttpClient httpClient = new HttpClient();
            HttpResponseMessage httpResponse;

		    /*
		     * Add Query Parameters
		     */
            int count = 0;
		    while(queryParameters.MoveNext()) 
            {
			
			    String parameter = queryParameters.Current;
			    Connect.Model.ServiceDescriptor.Request.QueryParameter queryParameter = connectionRequest.GetQueryParameter(parameter);
			
                if(count == 0) 
                {
                    url.Append("?");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                } 
                else
                {
                    url.Append("&");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
		    }
				
		    /*
		     * Add Header Parameters
		     */
		    while(headerParameters.MoveNext()) 
            {
			
			    String header = headerParameters.Current;
			    Connect.Model.ServiceDescriptor.Request.HeaderParameter headerParameter = connectionRequest.GetHeaderParameter(header);

                httpClient.DefaultRequestHeaders.TryAddWithoutValidation(header, headerParameter.GetValue());
		    }
		

            /* execute */
        
            try 
            {
                Task<HttpResponseMessage> httpResponseMessage = httpClient.GetAsync(url.ToString());
                httpResponseMessage.Wait();

                httpResponse = httpResponseMessage.Result; 
            } 
            catch(System.Exception exception) 
            {
        	    Log.Error(typeof(HttpConnectionWorker).Name, "Get", "Exception caught while executing request, " + exception.Message);
        	    throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Get", "Exception caught while executing request, " + exception.Message);
            }


            /* return response */
            if(!httpResponse.IsSuccessStatusCode) 
            {
                return (IConnectionResponse)new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), new ConnectionStatusCodes().GetStatusMessage(Convert.ToInt32(httpResponse.StatusCode.ToString())));
            }


            Task<Stream> repsonseStreamAsync = httpResponse.Content.ReadAsStreamAsync();
            repsonseStreamAsync.Wait();

            Stream responseStream = repsonseStreamAsync.Result;

            return (IConnectionResponse)new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), responseStream);
	    }
        public IConnectionResponse Get(IConnectionRequest connectionRequest)
        {
            if (connectionRequest == null)
            {
                Log.Error(typeof(HttpConnectionWorker).Name, "Get", "Invalid Connection Request.");
                throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Get", "Invalid Connection Request.");
            }

            /*if (connectionRequest.GetUrl().Contains("get_books"))
             * {
             *  String books = "<books><book><name>C</name><description>C Description</description><author>C Author</author><link>C Link</link></book><book><name>C Plus</name><description>C Plus Description</description><author>C Plus Author</author><link>C Plus Link</link></book><book><name>C Sharp</name><description>C Sharp Description</description><author>C Sharp Author</author><link>C Sharp Link</link></book><book><name>Java</name><description>Java Description</description><author>Java Author</author><link>Java Link</link></book><book><name>JavaScript</name><description>JavaScript Description</description><author>JavaScript Author</author><link>JavaScript Link</link></book><book><name>Swift</name><description>Swift Description</description><author>Swift Author</author><link>Swift Link</link></book><book><name>Objective C</name><description>Objective C Description</description><author>Objective C Author</author><link>Objective C Link</link></book></books>";
             *  Stream booksStream;
             *
             *  byte[] bytes = new byte[books.Length * sizeof(char)];
             *  System.Buffer.BlockCopy(books.ToCharArray(), 0, bytes, 0, bytes.Length);
             *
             *  try
             *  {
             *      booksStream = Utils.Utils.ToStream(bytes);
             *      return new ConnectionResponse(200, booksStream);
             *  }
             *  catch (SiminovException se)
             *  {
             *
             *  }
             * }
             * else
             * {
             *  String lessions = "<lessions><lession><name>C First Lession</name><description>C First Lession Description</description><link>C First Lession Link</link></lession><lession><name>C Second Lession</name><description>C Second Lession Description</description><link>C Second Lession Link</link></lession></lessions>";
             *  Stream lessionsStream;
             *
             *  byte[] bytes = new byte[lessions.Length * sizeof(char)];
             *  System.Buffer.BlockCopy(lessions.ToCharArray(), 0, bytes, 0, bytes.Length);
             *
             *  try
             *  {
             *      lessionsStream = Utils.Utils.ToStream(bytes);
             *      return new ConnectionResponse(200, lessionsStream);
             *  }
             *  catch (SiminovException se)
             *  {
             *
             *  }
             * }
             *
             * return new ConnectionResponse(200, "");*/


            /*
             * Request Parameters
             */
            StringBuilder url = new StringBuilder(connectionRequest.GetUrl());

            IEnumerator <String> queryParameters  = connectionRequest.GetQueryParameters();
            IEnumerator <String> headerParameters = connectionRequest.GetHeaderParameters();


            /*
             * Make Request
             */
            HttpClient          httpClient = new HttpClient();
            HttpResponseMessage httpResponse;

            /*
             * Add Query Parameters
             */
            int count = 0;

            while (queryParameters.MoveNext())
            {
                String parameter = queryParameters.Current;
                Connect.Model.ServiceDescriptor.Request.QueryParameter queryParameter = connectionRequest.GetQueryParameter(parameter);

                if (count == 0)
                {
                    url.Append("?");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
                else
                {
                    url.Append("&");
                    url.Append(parameter + "=" + queryParameter.GetValue());
                }
            }

            /*
             * Add Header Parameters
             */
            while (headerParameters.MoveNext())
            {
                String header = headerParameters.Current;
                Connect.Model.ServiceDescriptor.Request.HeaderParameter headerParameter = connectionRequest.GetHeaderParameter(header);

                httpClient.DefaultRequestHeaders.TryAddWithoutValidation(header, headerParameter.GetValue());
            }


            /* execute */

            try
            {
                Task <HttpResponseMessage> httpResponseMessage = httpClient.GetAsync(url.ToString());
                httpResponseMessage.Wait();

                httpResponse = httpResponseMessage.Result;
            }
            catch (System.Exception exception)
            {
                Log.Error(typeof(HttpConnectionWorker).Name, "Get", "Exception caught while executing request, " + exception.Message);
                throw new ConnectionException(typeof(HttpConnectionWorker).Name, "Get", "Exception caught while executing request, " + exception.Message);
            }


            /* return response */
            if (!httpResponse.IsSuccessStatusCode)
            {
                return((IConnectionResponse) new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), new ConnectionStatusCodes().GetStatusMessage(Convert.ToInt32(httpResponse.StatusCode.ToString()))));
            }


            Task <Stream> repsonseStreamAsync = httpResponse.Content.ReadAsStreamAsync();

            repsonseStreamAsync.Wait();

            Stream responseStream = repsonseStreamAsync.Result;

            return((IConnectionResponse) new ConnectionResponse(new ConnectionStatusCodes().GetStatusCode(httpResponse.StatusCode.ToString()), responseStream));
        }