public HttpResponseMessage Post([FromBody] StorageTypeModel storageType)
        {
            try
            {
                var entity = this.modelFactory.Parse(storageType);

                if (entity == null)
                {
                    return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad formed JSON request."));
                }

                var storageTypeCheck = this.Validate.StorageTypeCheck(entity.StorageName, entity.Url);

                if (storageTypeCheck != string.Empty)
                {
                    return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, storageTypeCheck));
                }

                if (this.movieRepo.Add(entity))
                {
                    if (this.movieRepo.SaveAll())
                    {
                        return(this.Request.CreateResponse(HttpStatusCode.Created, this.modelFactory.Create(entity)));
                    }
                }

                return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad formed JSON request."));
            }
            catch (Exception e)
            {
                return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, e));
            }
        }
        public HttpResponseMessage Patch(int id, [FromBody] StorageTypeModel model)
        {
            try
            {
                var entity = this.movieRepo.GetSingleStorageType(id);
                if (entity == null)
                {
                    return(this.Request.CreateResponse(HttpStatusCode.NotFound));
                }

                var parsedStorage = this.modelFactory.ParsePatch(model, id);
                if (parsedStorage == null)
                {
                    return(this.Request.CreateResponse(HttpStatusCode.BadRequest));
                }

                var storageCheck = this.Validate.StorageTypeCheck(parsedStorage.StorageName, parsedStorage.Url);

                if (storageCheck == null)
                {
                    return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, storageCheck));
                }

                if (this.movieRepo.SaveAll())
                {
                    return(this.Request.CreateResponse(HttpStatusCode.OK));
                }

                return(this.Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            catch (Exception ex)
            {
                return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }