// This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Enable CORS
            // Set it before of enable MVC
            services.AddCors();
            // Add framework services.
            services.AddMvc();
            // Setup options with DI
            services.AddOptions();
            // Setup Swagger
            services.AddSwaggerGen();
            SwaggerConfiguration.AddSwagger(services);
            // Configuration Properties
            services.Configure <MySqlDataSourcePropertyConfiguration>(Configuration.GetSection("DatabaseConfiguration"));

            // Create the container builder.
            var builder = new ContainerBuilder();

            RepositoryConfiguration.AddRepositories(builder);
            ServiceConfiguration.AddServices(builder);
            builder.Populate(services);
            this.ApplicationContainer = builder.Build();

            // Create the IServiceProvider based on the container.
            return(new AutofacServiceProvider(this.ApplicationContainer));
        }