private static IEnumerable <SwaggerRoute> GenerateOperationImportRoutes(ODataRoute oDataRoute)
        {
            Contract.Requires(oDataRoute != null);
            Contract.Requires(oDataRoute.Constraints != null);

            return(oDataRoute.GetEdmModel()
                   .EntityContainer
                   .OperationImports()?
                   .Select(operationImport => new SwaggerRoute(ODataSwaggerUtilities.GetPathForOperationImport(operationImport), oDataRoute,
                                                               ODataSwaggerUtilities.CreateSwaggerPathForOperationImport(operationImport, oDataRoute))));
        }
        /// <summary>
        /// Initialize the operations to Swagger model.
        /// </summary>
        /// <param name="oDataRoute">The o data route.</param>
        /// <returns></returns>
        private static IEnumerable <SwaggerRoute> GenerateOperationRoutes(ODataRoute oDataRoute)
        {
            Contract.Requires(oDataRoute != null);
            Contract.Requires(oDataRoute.Constraints != null);

            var routes = new List <SwaggerRoute>();

            var edmSchemaElements = oDataRoute.GetEdmModel().SchemaElements;

            if (edmSchemaElements != null)
            {
                foreach (var operation in edmSchemaElements.OfType <IEdmOperation>())
                {
                    // skip unbound operation
                    if (!operation.IsBound)
                    {
                        continue;
                    }

                    var edmOperationParameters = operation.Parameters;
                    if (edmOperationParameters != null && edmOperationParameters.Any())
                    {
                        var boundParameter = edmOperationParameters.First();
                        Contract.Assume(boundParameter != null);

                        var boundType = boundParameter.GetOperationType().GetDefinition();

                        // skip operation bound to non entity (or entity collection)
                        if (boundType.TypeKind == EdmTypeKind.Entity)
                        {
                            var entityType    = (IEdmEntityType)boundType;
                            var edmEntitySets = oDataRoute.GetEdmModel().EntityContainer.EntitySets();
                            Contract.Assume(edmEntitySets != null);
                            routes.AddRange(edmEntitySets.Where(es => es.GetEntityType().Equals(entityType)).Select(entitySet => new SwaggerRoute(ODataSwaggerUtilities.GetPathForOperationOfEntity(operation, entitySet, oDataRoute), oDataRoute, ODataSwaggerUtilities.CreateSwaggerPathForOperationOfEntity(operation, entitySet, oDataRoute))));
                        }
                        else if (boundType.TypeKind == EdmTypeKind.Collection)
                        {
                            var collectionType = boundType as IEdmCollectionType;

                            if (collectionType?.ElementType?.GetDefinition().TypeKind == EdmTypeKind.Entity)
                            {
                                var entityType    = (IEdmEntityType)collectionType.ElementType?.GetDefinition();
                                var edmEntitySets = oDataRoute.GetEdmModel().EntityContainer.EntitySets();
                                Contract.Assume(edmEntitySets != null);
                                routes.AddRange(edmEntitySets.Where(es => es.GetEntityType().Equals(entityType)).Select(entitySet => new SwaggerRoute(ODataSwaggerUtilities.GetPathForOperationOfEntitySet(operation, entitySet, oDataRoute), oDataRoute, ODataSwaggerUtilities.CreateSwaggerPathForOperationOfEntitySet(operation, entitySet, oDataRoute))));
                            }
                        }
                    }
                }
            }

            return(routes);
        }