Each sheriff may appoint as many deputies as the sheriff may think proper and may revoke such appointments at will; except that a sheriff shall adopt personnel policies, including policies for the review of revocation of appointments. Before revoking an appointment of a deputy, the sheriff shall notify the deputy of the reason for the proposed revocation and shall give the deputy an opportunity to be heard by the sheriff. Persons may also be deputized by the sheriff or undersheriff in writing to do particular acts.