public IActionResult CreateInstitution(InstitutionResource institutionResource)
        {
            if (institutionResource == null)
            {
                ProblemDetails problem = new ProblemDetails
                {
                    Title    = "Failed creating the institution.",
                    Detail   = "The institution resource is null.",
                    Instance = "E80F9611-EE07-4FF0-8D53-7693CE1AE26E"
                };
                return(BadRequest(problem));
            }

            Institution institution = mapper.Map <InstitutionResource, Institution>(institutionResource);

            try
            {
                institutionService.Add(institution);
                institutionService.Save();
                InstitutionResourceResult model = mapper.Map <Institution, InstitutionResourceResult>(institution);
                return(Created(nameof(CreateInstitution), model));
            } catch (DbUpdateException e)
            {
                Log.Logger.Error(e, "Database exception");

                ProblemDetails problem = new ProblemDetails
                {
                    Title    = "Failed Saving the institution.",
                    Detail   = "Failed saving the institution to the database.",
                    Instance = "20C197B7-24E1-4112-8999-6BB3DFD03FB6"
                };
                return(BadRequest(problem));
            }
        }
        public async Task <IActionResult> GetInstitution(int id)
        {
            if (id <= 0)
            {
                ProblemDetails problem = new ProblemDetails
                {
                    Title    = "Invalid id specified.",
                    Detail   = "The specified id is invalid.",
                    Instance = "17DE6E26-6759-423D-A33B-8CEC38F158A3"
                };
                return(BadRequest(problem));
            }

            Institution institution = await institutionService.FindAsync(id);

            if (institution == null)
            {
                ProblemDetails problem = new ProblemDetails
                {
                    Title  = "Failed getting the institution.",
                    Detail =
                        "The database does not contain an institution with the specified id.",
                    Instance = "89378B11-601A-4512-BFF9-F02FC510DF03"
                };
                return(NotFound(problem));
            }

            InstitutionResourceResult model = mapper.Map <Institution, InstitutionResourceResult>(institution);

            return(Ok(model));
        }