public async Task <IActionResult> Delete(int id)
        {
            if (ModelState.IsValid)
            {
                ContactManagerHelper.HeaderValidation(Request);
                await _repository.Delete(id);

                return(Ok(id));
            }
            return(BadRequest(ModelState));
        }
        public async Task <IActionResult> Put([FromBody] Contact contact)
        {
            if (ModelState.IsValid)
            {
                ContactManagerHelper.HeaderValidation(Request);
                await _repository.Update(contact);

                return(Ok(contact));
            }
            return(BadRequest(ModelState));
        }
        public async Task <IActionResult> Get()
        {
            try
            {
                ContactManagerHelper.HeaderValidation(Request);
                var contacts = await _repository.Get();

                return(Ok(contacts));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public async Task <IActionResult> Post([FromBody] ContactViewModel contact)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ContactManagerHelper.HeaderValidation(Request);
                    var createdContact = await _repository.Create(contact);

                    return(Created("newContact", createdContact));
                }
                return(BadRequest(ModelState));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public async Task <IActionResult> Get(int id)
        {
            try
            {
                ContactManagerHelper.HeaderValidation(Request);
                var contact = await _repository.Get(id);

                if (contact is null)
                {
                    return(NotFound());
                }
                return(Ok(contact));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }