Made changes to return the 404 when entity is not found
and 400 incase of null or empty entity