protected void PopulateApiDescriptions(ODataActionDescriptor oDataActionDescriptor, List<ApiParameterDescription> parameterDescriptions, string apiDocumentation, List<ApiDescription> apiDescriptions)
        {
            Contract.Requires(oDataActionDescriptor != null);
            Contract.Requires(apiDescriptions != null);

            // request formatters
            var bodyParameter = default(ApiParameterDescription);
            if (parameterDescriptions != null)
            {
                bodyParameter = parameterDescriptions.FirstOrDefault(description => description.Source == ApiParameterSource.FromBody);
            }

            var httpConfiguration = oDataActionDescriptor.ActionDescriptor.Configuration;
            Contract.Assume(httpConfiguration != null);
            var mediaTypeFormatterCollection = httpConfiguration.Formatters;
            var responseDescription = oDataActionDescriptor.ActionDescriptor.CreateResponseDescription();
            IEnumerable<MediaTypeFormatter> supportedRequestBodyFormatters = new List<MediaTypeFormatter>();
            IEnumerable<MediaTypeFormatter> supportedResponseFormatters = new List<MediaTypeFormatter>();
            if (mediaTypeFormatterCollection != null)
            {
                supportedRequestBodyFormatters = bodyParameter != null ? mediaTypeFormatterCollection.Where(CanReadODataType(oDataActionDescriptor, bodyParameter)) : Enumerable.Empty<MediaTypeFormatter>();

                // response formatters
                var returnType = responseDescription.ResponseType ?? responseDescription.DeclaredType;
                supportedResponseFormatters = returnType != null && returnType != typeof (void) ? mediaTypeFormatterCollection.Where(CanWriteODataType(oDataActionDescriptor, returnType)) : Enumerable.Empty<MediaTypeFormatter>();


                // Replacing the formatter tracers with formatters if tracers are present.
                supportedRequestBodyFormatters = GetInnerFormatters(supportedRequestBodyFormatters);
                supportedResponseFormatters = GetInnerFormatters(supportedResponseFormatters);
            }

            var supportedHttpMethods = GetHttpMethodsSupportedByAction(oDataActionDescriptor.Route, oDataActionDescriptor.ActionDescriptor);
            foreach (var supportedHttpMethod in supportedHttpMethods)
            {
                var apiDescription = new ApiDescription
                {
                    Documentation = apiDocumentation,
                    HttpMethod = supportedHttpMethod,
                    RelativePath = oDataActionDescriptor.RelativePathTemplate.TrimStart('/'),
                    ActionDescriptor = oDataActionDescriptor.ActionDescriptor,
                    Route = oDataActionDescriptor.Route
                };

                var apiSupportedResponseFormatters = apiDescription.SupportedResponseFormatters;
                Contract.Assume(apiSupportedResponseFormatters != null);
                apiSupportedResponseFormatters.AddRange(supportedResponseFormatters);

                var apiSupportedRequestBodyFormatters = apiDescription.SupportedRequestBodyFormatters;
                Contract.Assume(apiSupportedRequestBodyFormatters != null);
                apiSupportedRequestBodyFormatters.AddRange(supportedRequestBodyFormatters);

                if (parameterDescriptions != null)
                {
                    var apiParameterDescriptions = apiDescription.ParameterDescriptions;
                    Contract.Assume(apiParameterDescriptions != null);
                    apiParameterDescriptions.AddRange(parameterDescriptions);
                }

                // Have to set ResponseDescription because it's internal!??
                apiDescription.SetInstanceProperty("ResponseDescription", responseDescription);

                if (apiDescription.ParameterDescriptions != null)
                {
                    apiDescription.RelativePath = apiDescription.GetRelativePathForSwagger();
                }

                apiDescriptions.Add(apiDescription);
            }
        }